zcbor
Code generation and data validation using CDDL schemas
What it is and what it does
zcbor is a CDDL schema processor that works in two modes: as a validator for YAML, JSON, and CBOR data, and as a code generator that produces C implementations for encoding and decoding CBOR according to a schema. The package includes a C library (also used standalone in Zephyr RTOS) that handles the low-level CBOR operations; when you generate C code, zcbor either references this library via CMake or copies its sources to your project.
The tool targets developers working with CBOR serialization who need either runtime validation in Python or embedded C implementations. CDDL (Concise Data Definition Language, RFC 8610) provides a powerful schema syntax for defining complex binary data structures, making zcbor useful for IoT, embedded systems, and any project where CBOR is the wire format.
Use it for:
- Validate incoming CBOR messages against a schema before processing in a Python service.
- Generate C code for CBOR encoding/decoding in embedded or IoT firmware projects.
- Convert between YAML/JSON and CBOR formats with schema-enforced validation.
- Define and validate complex binary protocols using CDDL schemas.
- Integrate CBOR serialization into Zephyr RTOS or other embedded systems via the C library.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
zcbor validates and converts YAML/JSON/CBOR data against CDDL schemas, and generates C code for encoding/decoding CBOR data with schema validation.
Yes. zcbor fills a specific niche—CDDL-based CBOR validation and C code generation—with low install friction, active maintenance, no known vulnerabilities, and a permissive license. Install it if you need schema-driven CBOR handling in Python or C; skip it if you work exclusively with JSON or don't require CDDL's advanced schema features.
Install
zcbor on PyPI
pip
pip install zcboruv
uv add zcborpoetry
poetry add zcborInstalling zcbor
Before you install
Low friction install as a pure Python wheel. Actively maintained with recent commits and a stable release cadence; last release was 666 days ago with active repository status.
License in practice
Apache permissive license allows commercial and private use with minimal restrictions, suitable for most projects including those generating proprietary C code.
Quickstart
pip install zcbor
import zcbor
# Validate YAML/JSON/CBOR against a CDDL schema
zcbor.validate(data, schema_file)
# Or generate C code: zcbor code-gen schema.cddl --output-c
Requires Python >= 3.8; generated C code depends on the bundled C library included in the package.
Verify before relying
- Whether the bundled C library requires compilation or system dependencies on target platforms
- Performance characteristics when validating large CBOR datasets
- Completeness of CDDL RFC 8610 feature coverage
Package facts
| License | Apache (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — cbor2, pyyaml, regex |
| Maintenance | actively maintained — 666 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 383,063/month — #7,082 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: zcbor-0.9.1-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
cbor2Encodes and decodes CBOR (Concise Binary Object…
permissive · top 1,000 on PyPI
cborSerializes and deserializes data in CBOR…
permissive · top 5,000 on PyPI
kcidb-iokcidb-io validates and manipulates Linux Kernel…
copyleft · top 15,000 on PyPI
yamaleYamale validates YAML files against a schema…
permissive · top 5,000 on PyPI
kubernetes-validateValidates Kubernetes resource definitions…
permissive · top 15,000 on PyPI
avro-validatorValidates Python data against Avro schemas and…
permissive · top 15,000 on PyPI
annotatedyamlParses and validates YAML files with support…
permissive · top 15,000 on PyPI
check-jsonschemaA command-line tool and pre-commit hook that…
permissive · top 5,000 on PyPI
pykwalifyValidates YAML and JSON data against schemas…
permissive · top 5,000 on PyPI
msgspecmsgspec encodes and decodes JSON, MessagePack,…
permissive · top 1,000 on PyPI