A reasonably fast DAG-CBOR encoder/decoder for Python
Project description
dag-cbrrr
Convert between DAG-CBOR and Python objects at hundreds of megabytes per second. Take a look at the benchmarks
Other than speed, a distinguishing feature is that it operates non-recursively. This means you can parse arbitrarily deeply nested objects without running out of call stack (although of course you might still run out of heap)
Status: WIP, but almost in a usable state!
Installation
git clone https://github.com/DavidBuchanan314/dag-cbrrr
cd dag-cbrrr
python3 -m pip install -v .
Quickstart
Here's the basics.
import cbrrr
encoded = cbrrr.encode_dag_cbor({"hello": [b"world", 1, 2, 3]})
print(encoded) # b'\xa1ehello\x84Eworld\x01\x02\x03'
decoded = cbrrr.decode_dag_cbor(encoded)
print(decoded) # {'hello': [b'world', 1, 2, 3]}
For more detailed API information, take a look at the commented python source, which provides an ergonomic type-annotated wraper for the native module (more docs coming soon™)
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
cbrrr-0.0.1.tar.gz
(15.9 kB
view hashes)