Booby: data modeling and validation library

Booby is a standalone data modeling and validation library written in Python. Booby is under active development and licensed under the Apache2 license, so feel free to contribute and report errors and suggestions.

See the sample code below to get an idea of the main features:

from booby import *

class Token(Model):
    key = StringField()
    secret = StringField()

class User(Model):
    login = StringField(required=True)
    name = StringField()
    email = EmailField()
    token = EmbeddedField(Token, required=True)

jack = User(
    login=u'jacko',
    name=u'Jack',
    email=u'jack@example.com',
    token={
        'key': u'vs7df...',
        'secret': u'ds5ds4...'
    }
)

try:
    jack.validate()
except ValidationError:
    pass
else:
    print jack.to_json()

'{"email": "jack@example.com", "login": "jacko", "token": {"secret": "ds5ds4...", "key": "vs7df..."}, "name": "Jack"}'

Indices and tables

Project Versions

Table Of Contents

Next topic

Installation

This Page