Validate CBOR documents using CDDL schema language
Project description
PyCDDL: A CDDL validation library for Python
CDDL is a schema language for the CBOR serialization format.
pycddl
allows you to validate CBOR documents match a particular CDDL schema, based on the Rust cddl
library.
For example, here we use the cbor2
library to serialize a dictionary to CBOR, and then validate it:
from pycddl import Schema
import cbor2
uint_schema = Schema("""
object = {
xint: uint
}
"""
)
uint_schema.validate_cbor(cbor2.dumps({"xint", -2}))
If validation fails, a pycddl.ValidationError
is raised.
Release notes
0.2.0
- Schemas are now only parsed once (when the
Schema()
object is created), instead of every time validation happens, which should improve validation performance. - Updated to a newer version of underlying CDDL library, which should make CDDL parsing more compliant.
- Added a
repr()
implementation toSchema
for easier debugging.
0.1.11
- Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycddl-0.2.0.tar.gz
(14.8 kB
view hashes)
Built Distributions
Close
Hashes for pycddl-0.2.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40013bae4af92d465395063f2de8c7c46acfc7c9216d1acf65b9bb92ee7c14dc |
|
MD5 | 8d582a6f980a1365fbc0a7d82c132447 |
|
BLAKE2b-256 | e56d2183424eec043827ea3d55bb6945f51650af510a3516d5c07c2117f8b217 |
Close
Hashes for pycddl-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73983700068ff4cf4ae640376f4203258ce9a971248a540ee0ed3e2e78f10554 |
|
MD5 | 87a4a0bd370f3ea27d48b98890bc7e33 |
|
BLAKE2b-256 | bf65fa0c481d71f057eaa30ee21b422ba3e0283780ba54f34632f118ba41853c |
Close
Hashes for pycddl-0.2.0-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20076197e1cf69ada479c0911d14dabe46f4a0f82e5bdd9e1449913ce2cd0ea8 |
|
MD5 | 6e4dd33d1b8f97e9065df8813658fe62 |
|
BLAKE2b-256 | 6a8928b3d579a8b2d4d26e07d6ddeb5dc4055ce23f200d24e6d6516702a07c10 |