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



Base library for defining lean “contract” models for Python.


This is an implementation of “models” similar to those you see in most ORMs / forms definition systems, but with the main goal of keeping things as simple as possible.

No metaclasses or descriptors are involved; no hackish code messing up with standard Python objects functionality either.

The idea is to have a “layered” library, providing the bare bones needed to define your own schemas, along with some nice helpers for common cases.

Use cases

  • API clients
  • ORMs
  • Forms

Example model definition

from contracts.core import Contract, BaseField

# Use BaseField to define your field types, eg. StringField and
# IntegerField.

class MyModel(BaseObject):
    first_name = StringField()
    last_name = StringField()
    age = IntegerField()

Then, create some library to make use of the schema somehow 😊.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

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