This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Transform dictionaries into Python objects

Project Description

Easily create Python objects from dictionaries- basically an ORM that can work with any type of database. Usage example:

from cargo.spec import Spec, unpack
from cargo.fields import Field

class Model(Spec):
    name    = Field(str).With.length(6)
    version = Field(tuple).where.each.Is.An(int)

unpack(Model, {
    'name':'Eugene',
    'version':(0,1)
    })

Nested unpacking is currently supported but the library assumes that you are passing in objects of a reasonable depth (i.e. not recursive) and therefore does not cache the seen values.

cargo is still work in progress and it’s API may change either completeley or partially, or the internal functionality modified without any notice at any given point in time.

You can now get this package easily by installing the latest release from the Python Package Index, something like the following:

$ pip install cargo

If you want to run the test suites or contribute some code you need to install a library called Requires via pip, i.e. which will make the tests run:

$ pip install Requires
$ git clone ssh://git@github.com/eugene-eeo/cargo
$ python cargo/tests.py
Release History

Release History

This version
History Node

0.2.15

History Node

0.1.1

History Node

0.1

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting