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.
Reducing memory usage and safety constraints
In order to reduce memory usage, you can pass in any Python object that implements the buffer API and stores bytes, e.g. a memoryview() or a mmap object.
The passed-in object must be read-only, and the data must not change during validation! If you mutate the data while validation is happening the result can be memory corruption or other undefined behavior.
Release notes
0.5.3
- Upgrade to newer
cddlcrate (0.9.3). - Add Python 3.12 support.
0.5.2
- Upgrade to newer
cddlcrate (0.9.2), improving validation functionality.
0.5.1
- Upgrade to newer
cddlcrate, fixing some validation bugs.
0.5.0
- Support for ARM macOS.
- Dropped Python 3.7 support.
0.4.1
- Test fixes, with no user-relevant changes.
0.4.0
validate_cbor()now accepts read-only buffers, not justbytes. This is useful if you want to e.g. validate a large file, since you canmmap()it.- The GIL is released when parsing documents larger than 10KiB.
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
cddl0.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 toSchemafor 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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycddl-0.5.3.tar.gz.
File metadata
- Download URL: pycddl-0.5.3.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c95f3f69972516a721ada4b967c4869f5b8e0a2a6adaaa8544abf8730dc05ee2
|
|
| MD5 |
a49161b552ee5505d2653194aed50610
|
|
| BLAKE2b-256 |
fa8f4bd11f2b2a6d20bcc9c28dfe63e81fd525fec7c408629a0292816538429e
|
File details
Details for the file pycddl-0.5.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pycddl-0.5.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58e2b6062dc5c55347f01c64839348a2fd757fd892fd16d15df9b66a1c33410a
|
|
| MD5 |
3d2a7dfdb02c24c261b305e831a04e36
|
|
| BLAKE2b-256 |
b637f81033be04784691961137e8de87bcfd1aae3155bc1120e92731bbe0b837
|
File details
Details for the file pycddl-0.5.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pycddl-0.5.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2091cffa75fc3973e1bb40edeabb559e1315e188a9ee11b5946547913e333955
|
|
| MD5 |
0bd8b3a09b06c8bdf0d3e9d928cf8b29
|
|
| BLAKE2b-256 |
e60e0bf0b1d9698c5bbd8880b260433b86a5428110f5774022a24e1670482a5c
|
File details
Details for the file pycddl-0.5.3-cp311-none-win_amd64.whl.
File metadata
- Download URL: pycddl-0.5.3-cp311-none-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56e4bf7a4a023e1615a669031981d86674097b31ae8b9c62e459606741e582e4
|
|
| MD5 |
0c2b249c8ce22ae5fc10462c6bb4782e
|
|
| BLAKE2b-256 |
a821f891813c8e2d3b840b2382ba058b8b01db1576106149e9acce9d68d8170b
|
File details
Details for the file pycddl-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pycddl-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97994195cd76df3c6eb2225904ede4f4a3658c7caa3f0199400cd0ef1a67726d
|
|
| MD5 |
12eb2ae02da60313be911bc6667eccac
|
|
| BLAKE2b-256 |
9d0b226a6b57f666f108c52d990d2e4fa780346f6fa5c9468e06846e2bc997ae
|
File details
Details for the file pycddl-0.5.3-cp311-cp311-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl.
File metadata
- Download URL: pycddl-0.5.3-cp311-cp311-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64, macOS 11.0+ universal2 (ARM64, x86-64), macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
205f307533c3d2f95653967b52d5d04956efa363a59390ff5421375ffccd573d
|
|
| MD5 |
9a715b90f6b89cd553ced4c74d49c042
|
|
| BLAKE2b-256 |
5caa5a653ff858c2317ac9da6ac15ff54f943b89bd5afaa2c64b332f2409e8a9
|
File details
Details for the file pycddl-0.5.3-cp310-none-win_amd64.whl.
File metadata
- Download URL: pycddl-0.5.3-cp310-none-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e0651cf26bc5f925a5ccc1399fa5593604e0aa2bcd2136a78b33bf673fbb415
|
|
| MD5 |
4d4451b33a3dd286699744f6958e73f0
|
|
| BLAKE2b-256 |
c720e2c35828325d294265c0b650924b043eb4bf6bc1ce6224659d696f49f4de
|
File details
Details for the file pycddl-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pycddl-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14414b273d0e500228555818632fe75b95039233b2c0e3f560e16871de216bcc
|
|
| MD5 |
259e23f494d06ae1365b4d1c025ebb9f
|
|
| BLAKE2b-256 |
31dbe5e021285e5672d2097b17f9e0cc4059fc3a84a4ff9ead5903c8e555935d
|
File details
Details for the file pycddl-0.5.3-cp310-cp310-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl.
File metadata
- Download URL: pycddl-0.5.3-cp310-cp310-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64, macOS 11.0+ universal2 (ARM64, x86-64), macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a8088574731c938c592150f04eea359c08e941ee68a47b4320cde391f7527e4
|
|
| MD5 |
e39c1126e4da0ed7778e6c165709ef9f
|
|
| BLAKE2b-256 |
265f4e900533fad034a23805f3e639d9bd3b8cc54a1e6befc34b7a9a71a71fa7
|
File details
Details for the file pycddl-0.5.3-cp39-none-win_amd64.whl.
File metadata
- Download URL: pycddl-0.5.3-cp39-none-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34682379aed0ac925ce190ef58bf7192dece80b7b6d714e6fc17959f93bafa9e
|
|
| MD5 |
b1c36b68d431ce85ec668e4918c666d2
|
|
| BLAKE2b-256 |
f6df11c9e9015e8e6d37bb25331a153d9f7491c569a30f7f6f8b5bf75c26324d
|
File details
Details for the file pycddl-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pycddl-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26c266cd09e71ecc447af6778fea913a7e0e52fb97e5d9e97d5fb904fe9d5d9b
|
|
| MD5 |
54e7d15846a8b0cb4d9dcbf06d50d63c
|
|
| BLAKE2b-256 |
7584929cbf351d4d5b14b0154ccaa3880692f1b10693e4e95932814fd3825d88
|
File details
Details for the file pycddl-0.5.3-cp39-cp39-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl.
File metadata
- Download URL: pycddl-0.5.3-cp39-cp39-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64, macOS 11.0+ universal2 (ARM64, x86-64), macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd897085ecb8ce01880520b2dfe96e313d4741e8c0e9ef5d6e870e92cb0c741
|
|
| MD5 |
bfd64a14f4616fc5edecb12d8afbd25e
|
|
| BLAKE2b-256 |
13c6b951d19d1ea093bb38e6a3a25b96c61022e4624f2a7296f846624752a4d7
|
File details
Details for the file pycddl-0.5.3-cp38-none-win_amd64.whl.
File metadata
- Download URL: pycddl-0.5.3-cp38-none-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b93708f968b2d3bda517c9b6205cdfa8138dd2873c7f04ed5a2f3b2c4eeda729
|
|
| MD5 |
3ba2aa762c0b4b37a1fcb986b5475757
|
|
| BLAKE2b-256 |
4e89643c47e25e3189592e011cb7c34c41ac2a1838e9c4b67d1bac01f0e9d256
|
File details
Details for the file pycddl-0.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pycddl-0.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6f5c135dfb63065de776f16b0a9271505c5d727bb9fcd35d78f3319aae465cd
|
|
| MD5 |
71006b4a2c6f543d78c556e8eb1e7bfa
|
|
| BLAKE2b-256 |
cd4530d3f5184ad87fb3231516e1f46098f935985e371e0381236af4f46edaef
|
File details
Details for the file pycddl-0.5.3-cp38-cp38-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl.
File metadata
- Download URL: pycddl-0.5.3-cp38-cp38-macosx_11_0_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.8, macOS 11.0+ ARM64, macOS 11.0+ universal2 (ARM64, x86-64), macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43480b0678ca71ab8dddba6d6653a737884f5594e6c404a1fc072cffaf2b6f4c
|
|
| MD5 |
25c8764eb78000f756bff62cc0205b1f
|
|
| BLAKE2b-256 |
3db341db0c1aac0e39f7a025cbe19cbd76f24e98051c30388acd6634881bc96c
|