skip to navigation
skip to content

Not Logged In

booby 0.5.1

Data modeling and validation Python library

Latest Version: 0.5.2

https://secure.travis-ci.org/jaimegildesagredo/booby.png?branch=master

Booby is a standalone data modeling and validation library written in Python. Booby is under active development (visit this blog post for more info and the roadmap) 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 Model, fields

class Token(Model):
    key = fields.String()
    secret = fields.String()

class User(Model):
    login = fields.String(required=True)
    name = fields.String()
    email = fields.Email()
    token = fields.Embedded(Token, required=True)
    addresses = fields.Field(default=list)

class Address(Model):
    line_1 = fields.String()
    line_2 = fields.String()

jack = User(
    login='jack',
    name='Jack',
    email='jack@example.com',
    token={
        'key': 'vs7dfxxx',
        'secret': 'ds5ds4xxx'
    },
    addresses=[
        Address(line_1='Main Street'),
        Address(line_1='Main St')
    ]
)

if jack.is_valid:
    print jack.to_json(indent=2)
else:
    print json.dumps(dict(jack.validation_errors))
{
  "email": "jack@example.com",
  "login": "jack",
  "token": {
    "secret": "ds5ds4xxx",
    "key": "vs7dfxxx"
  },
  "name": "Jack",
  "addresses": [
    {
      "line_1": "Main St",
      "line_2": null
    },
    {
      "line_1": "Main Street",
      "line_2": null
    }
  ]
}

Installation

You can install the last stable release of Booby from PyPI using pip or easy_install.

$ pip install booby

Also you can install the latest sources from Github.

$ pip install -e git+git://github.com/jaimegildesagredo/booby.git#egg=booby

Tests

To run the Booby test suite you should install the development requirements and then run nosetests.

$ pip install -r requirements-devel.txt
$ nosetests tests/unit
$ nosetests tests/integration

Changes

See Changes.

Documentation

Booby docs are hosted on Read The Docs.

 
File Type Py Version Uploaded on Size
booby-0.5.1.tar.gz (md5) Source 2014-01-31 7KB
  • Downloads (All Versions):
  • 61 downloads in the last day
  • 464 downloads in the last week
  • 1813 downloads in the last month