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!

Schema validation for Python data structures

Project Description

Basic validation for Python data structures in a mostly declarative form (there is an escape hatch in “extraValidation” callables).

Validation errors are reported as both a path within the data structure (sequence of indices or keys) and a descriptive message (string).

Typical usage:

data = json.load(some_file) # or pickle, or ...
errors = dataschema.Validator(my_schema).validate(data)
if errors:
    for path, message in errors:
        # Report error `message` at path `path`.
else:
    # Any data access or application-specific validation can now
    # rely on properties of my_schema (e.g. minimum number of
    # elements in a sequence, data types of elements, presence of
    # certain keys in a dict, etc.).

See the unit tests for schema examples.

There are a few limitations (only string keys for any dictionaries in data) and a more fully Pythonic validator might focus on interfaces and abstract base classes over concrete types. However, dataschema is a great improvement over ad hoc validation code for many uses today.

Release History

Release History

This version
History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
dataschema-0.1.tar.gz (7.1 kB) Copy SHA256 Checksum SHA256 Source Feb 27, 2014

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