Skip to content

Latest commit

 

History

History
73 lines (44 loc) · 1.71 KB

README.rst

File metadata and controls

73 lines (44 loc) · 1.71 KB

canonicaljson-rs

Python package leveraging our Canonical JSON implementation in Rust.

In order to validate content signatures of our data, Canonical JSON gives us a predictable JSON serialization. And Rust allows us to reuse the same implementation between our server in Python (this package) and our diverse clients (Rust, Android/iOS, JavaScript).

Usage

pip install canonicaljson-rs
>>> import canonicaljson
>>>
>>> canonicaljson.dumps({"héo": 42})
'{"h\\u00e9o":42}'
  • canonicaljson.dumps(obj: Any) -> str
  • canonicaljson.dump(obj: Any, stream: IO) -> str

Development

We rely on a specific Python builder that automates everything around Rust bindings.

pip install maturin

In order to install the package in the current environment:

maturin develop

Run tests:

pytest

Release

  1. Create a release on Github on https://github.com/mozilla-services/python-canonicaljson-rs/releases/new
  2. Create a new tag vX.Y.Z (This tag will be created from the target when you publish this release.)
  3. Generate release notes
  4. Publish release

See Also

Other specs:

License

  • Mozilla Public License 2.0