Skip to content

Conversion between CBOR and CBOR Diagnostic Notation

Notifications You must be signed in to change notification settings

chrysn/cbor-diag-py

Repository files navigation

cbor-diag: Diagnostic notation (EDN) for CBOR

This Python module is a minimal wapper around the cbor-edn crate (formally around the cbor-diag crate). Unlike those crates, which offers lots of functionality for manipulating CBOR and its diagnostic notation, this module only exposes two very simple functions:

  • diag2cbor, which parses diagnostic notation and produces a corresponding CBOR binary string, and
  • cbor2diag, which does the inverse.

It is recommended to use the cbor2 package to actually process the CBOR data.

Documentation is available on readthedocs.

Installation

This project can be installed from PyPI; binary wheels are available there for the common platforms.

Maintenance

This package is considered feature-complete at release, and maintainened reactively -- when changes to the ecosystem threaten to make it unusable.

New features are only expected to be added if they are already present in the underlying cbor-edn crate, and will likely manifest as extra arguments to cbor2diag.

This package is built using maturin and pyo3 and largely follows their template. The built module is renamed from cbor_diag to _cbor_diag (and consequently wrapped manually) to avoid it being part of the package's public API. (The need for the workaround is tracked at maturin and through there in the typing module).

The package is currently hosted on GitHub at https://github.com/chrysn/cbor-diag-py because maturin can not yet build pipelines for GitLab or codeberg.

License

This package was written by Christian Amsüss <[email protected]>, and is published under the terms of MIT or Apache-2.0 license, at the user's choice.

Special thanks to Nemo157 for providing the cbor-diag crate, the authors of the peg crate (which does cbor-edn's heavy lifting), and Carsten Bormann for providing a PEG parser ready ABNF in the edn-literals draft.

About

Conversion between CBOR and CBOR Diagnostic Notation

Resources

Stars

Watchers

Forks

Packages

No packages published