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.3.0
- Fixed major bug where if the document was valid UTF-8, the library would attempt to parse it as JSON!
- Added support for ARM macOS.
0.2.2
- Updated to
cddl
0.9.1.
0.2.1
- Added PyPy wheels.
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.3.0.tar.gz
(16.9 kB
view hashes)
Built Distributions
Close
Hashes for pycddl-0.3.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56f604e3510ba992116e3d81e7aec57e630eacd3d8155ab1d339f962cffdd6c4 |
|
MD5 | c55eb51ac0e1d01380881df5ea6d66b4 |
|
BLAKE2b-256 | 7d7bd6c8968da5315dc41b29b8bedbfd0c4f59f48dbdb914e8128ecd9687c7ad |
Close
Hashes for pycddl-0.3.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0aed8bbd4a4169b0c3381c72ec75fdf541133ec9c9a12d5d494c9a3d2bd55bf |
|
MD5 | 91def1669c4ebee4709d1f58e17c1c3f |
|
BLAKE2b-256 | 9af3b5f49fc0aac816d1383398df51d596666a87642bc9b7fe54cd1c80e989f2 |
Close
Hashes for pycddl-0.3.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9baa6d52334453fe4e47ca0ea95a32e26a3a088f5b89523c4cf335ee94122ae |
|
MD5 | 828f5707087af67bf2569b58ef1d9fb3 |
|
BLAKE2b-256 | aef378049628a56a75329a634721f947d5ed1d5a31e014c6c3c82320098010d4 |
Close
Hashes for pycddl-0.3.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f40a7e4110238a780b46883df77f326639128bf2d705b55be8d532ad5c1d1aef |
|
MD5 | 0f6caf60c51afa4fcfcff20e4799225c |
|
BLAKE2b-256 | d11c816aee5f69d131ad2b1f8e7f1104ebc4a5ac510dae383dd0a6bb4ee57e1a |
Close
Hashes for pycddl-0.3.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52eee76d7856d05387debe8dda4989e257b331aadda9c0836b9ab3663b6a58ee |
|
MD5 | 53751da7a375dcd7dc68006df3adf4d7 |
|
BLAKE2b-256 | 2a224f66a58b91553db1c856cd164ad8c8b34d4e21030326f1e4604f215315d3 |
Close
Hashes for pycddl-0.3.0-cp37-abi3-macosx_10_15_x86_64.macosx_10_15_arm64.macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33326e7dc1f1fe972efdaf33fb2f771302f94dd1792595f6f2839b65c5c492f6 |
|
MD5 | c5a1c07ec481e1154b03e011109b2d74 |
|
BLAKE2b-256 | 5c6a8c27a067f65de2204f7a5e76c8ddea75ec1125a187902c778a02609f7ebf |