Skip to content
/ cbors Public

A Python CBOR (de)serialization module, powered by Rust

License

Notifications You must be signed in to change notification settings

mjkoo/cbors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cbo-rs

CI PyPI

A Python CBOR (de)serialization module, powered by Rust.

Wraps the excellent serde_cbor crate and provides a pythonic interface via pyo3.

Installation

Python>=3.5 is required due to the requirements of pyo3.

Recommended to install from PyPI, e.g.

pip install cbors

To install from source, use maturin to build a wheel from repository root.

maturin build -i python3
pip install target/wheels/*.whl

Usage

Serialize data via cbors.dumpb, deserialize via cbors.loadb.

Interface is similar to the standard library's json module.

import cbors

b = cbors.dumpb("foo")
assert(b == b"cfoo")

s = cbors.loadb(b)
assert(s = "foo")

Limitations

As this uses serde_cbor under the hood, the same limitations apply here.

Notably, tags are not currently supported (see pyfisch/cbor#3).

If this functionality is important to you, cbor2 might be a better choice.

Development

For local development, it is recommended to create a virtual environment, and build the module via maturin develop.

A Dockerfile is provided which will build and install the module and run the test suite.

If you do not want to use docker, it is recommended to use tox for testing.

Pull requests welcome!

About

A Python CBOR (de)serialization module, powered by Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published