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)
else:
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.
License
Conformity is licensed under the Apache License, version 2.0.
Installation
Conformity is available in PyPi and can be installing directly via Pip or listed in setup.py, requirements.txt, or Pipfile:
pip install 'conformity~=1.26'
install_requires=[
...
'conformity~=1.26',
...
]
conformity~=1.26
conformity = {version="~=1.26"}
Documentation
The complete Conformity documentation is available on Read the Docs!
Metadata
Release files for conformity 1.28.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| conformity-1.28.2.tar.gz | 43.6 kB | Without provenance | Details for conformity-1.28.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| conformity-1.28.2-py27.py35.py36.py37.py38-none-any.whl | Python 2.7, Python 3.5, Python 3.7, Python 3.8, Python 3.6 | none | any | Details for conformity-1.28.2-py27.py35.py36.py37.py38-none-any.whl |
Total release size: 96.8 kB
Release files / conformity-1.28.2.tar.gz
| Download URL | conformity-1.28.2.tar.gz |
|---|---|
| Size | 43.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f47d84f83edfe0904bdaffb2eab21f215b8dc90c3fa5c9c85f523bbe39fe98d
|
|
BLAKE2b-256 checksum How to use checksums |
e972aca3c4c7e9e12216a54bb093fae9f92d3938c0d9051bb9cd1d5f71da2f02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.1
|
Release files / conformity-1.28.2-py27.py35.py36.py37.py38-none-any.whl
| Download URL | conformity-1.28.2-py27.py35.py36.py37.py38-none-any.whl |
|---|---|
| Size | 53.2 kB |
| Tags | Python 2.7 Python 3.5 Python 3.6 Python 3.7 Python 3.8 |
|
SHA-256 checksum How to use checksums |
e3dd522bdc3dac6982b3ce5b01a78afeb932c7a3dfb34ca7ce5b97de5190ab0c
|
|
BLAKE2b-256 checksum How to use checksums |
b861017489c1bec80b01bd13be8a254676f26addc4c437ec1092b3c61a14b4c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.1
|
Security for conformity 1.28.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.