Skip to content

c0mm4nd/python-canonicaljson-rs

 
 

Repository files navigation

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

Release

Update version in Cargo.toml and:

vim Cargo.toml
git ci -am "Bump version"
git tag -a vX.Y.Z
git push vX.Y.Z

Publish wheel for your host OS:

maturin build
maturin publish

Publish wheels of all architectures on PyPi:

  1. Download artifacts from Github Actions run on tag vX.Y.Z. On the bottom of the Publish wheels workflow summary page, download the pypi_files.zip and extract it locally.
  2. Run twine check --strict pypi_files/*.whl
  3. Publish on PyPi with twine upload --skip-existing pypi_files/*.whl

See Also

Other specs:

License

  • Mozilla Public License 2.0

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 79.1%
  • Python 20.9%