Skip to main content

Cacheable schema description and validation

Project description

Conformity is a declarative schema validation library designed for use in libraries, services, application settings, and more.

Declare a schema:

from conformity.fields import Dictionary, Float, Integer, List, UnicodeString

person = Dictionary({
    "name": UnicodeString(),
    "height": Float(gte=0),
    "event_ids": List(Integer(gt=0)),

Check to see if data is valid:

data = {"name": "Andrew", "height": 180.3, "event_ids": [1, "3"]}
errors = person.errors(data)

# Key event_ids: Index 1: Not an integer

And wrap functions to validate on the way in and out:

kwargs = Dictionary({
    "name": UnicodeString(),
    "score": Integer(),
}, optional_keys=["score"])

@validate_call(kwargs, UnicodeString())
def greet(name, score=0):
    if score > 10:
        return "So nice to meet you, {}!".format(name)
        return "Hello, {}.".format(name)

There’s support for basic string, numeric, geographic, temporal, networking, and other field types, with everything easily extensible (optionally via subclassing). Conformity also boasts support for full-blown application settings schema definition and validation complete with definable defaults, and includes Sphinx autodoc extensions to help you generate meaningful documentation for your code using Conformity.


Conformity is licensed under the Apache License, version 2.0.


Conformity is available in PyPi and can be installing directly via Pip or listed in, requirements.txt, or Pipfile:

pip install 'conformity~=1.26'
conformity = {version="~=1.26"}


The complete Conformity documentation is available on Read the Docs!

Project details

Download files

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

Files for conformity, version 1.26.3
Filename, size File type Python version Upload date Hashes
Filename, size conformity-1.26.3-py27.py35.py36.py37-none-any.whl (50.5 kB) File type Wheel Python version py27.py35.py36.py37 Upload date Hashes View hashes
Filename, size conformity-1.26.3.tar.gz (40.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page