Skip to content

Commit 549cd49

Browse files
authored
Merge pull request #1 from leplatrem/prepare-package
Add packaging boilerplate
2 parents 6df505e + d892009 commit 549cd49

File tree

8 files changed

+107
-12
lines changed

8 files changed

+107
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
22
__pycache__
3+
.vscode/

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Changelog
2+
=========
3+
4+
1.0.0
5+
-----
6+
7+
* Initial version

CONTRIBUTORS.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Contributors
2+
============
3+
4+
* Mathieu Leplatre <[email protected]>

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
2-
name = "pyext-canonicaljson"
3-
version = "0.1.0"
2+
name = "canonicaljson-rs"
3+
version = "1.0.0"
44
authors = ["Mathieu Leplatre <[email protected]>"]
55
edition = "2018"
66

README.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
canonicaljson-rs
2+
################
3+
4+
Python package leveraging our Canonical JSON implementation in Rust.
5+
6+
In order to validate content signatures of our data, Canonical JSON gives us a predictable JSON serialization.
7+
And Rust allows us to reuse the same implementation between our server in Python (this package) and our diverse clients (Rust, Android/iOS, JavaScript).
8+
9+
Usage
10+
=====
11+
12+
.. code-block ::
13+
14+
pip install canonicaljson-rs
15+
16+
.. code-block :: python
17+
18+
>>> import canonicaljson
19+
>>>
20+
>>> canonicaljson.dumps({"foo": 42})
21+
'{"foo":42}'
22+
23+
24+
* ``canonicaljson.dumps(obj: Any) -> str``
25+
* ``canonicaljson.dump(obj: Any, stream: IO) -> str``
26+
27+
28+
See Also
29+
========
30+
31+
* https://github.com/Kinto/kinto-signer/blob/6.1.0/kinto_signer/canonicaljson.py
32+
* https://searchfox.org/mozilla-central/rev/b2395478c/toolkit/modules/CanonicalJSON.jsm
33+
* https://github.com/matrix-org/python-canonicaljson
34+
* The code to build a ``serde_json::Value`` from a ``pyo3::PyObject`` was greatly inspired by Matthias Endler's `hyperjson <https://github.com/mre/hyperjson/>`_
35+
36+
Development
37+
===========
38+
39+
We rely on a specific Python builder that automates everything around Rust bindings.
40+
41+
.. code-block ::
42+
43+
pip install maturin
44+
45+
In order to install the package in the current environment:
46+
47+
.. code-block ::
48+
49+
maturin develop
50+
51+
Build and Release:
52+
53+
.. code-block ::
54+
55+
vim Cargo.toml
56+
git ci -am "Bump version"
57+
git tag -a v1.2.3
58+
59+
Update version in ``Cargo.toml`` and:
60+
61+
.. code-block ::
62+
63+
maturin build
64+
maturin publish
65+
66+
License
67+
=======
68+
69+
* Mozilla Public License 2.0

canonicaljson.so

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[build-system]
2+
requires = ["maturin"]
3+
build-backend = "maturin"
4+
5+
[package.metadata.maturin]
6+
classifier = [
7+
"Intended Audience :: Developers",
8+
"License :: OSI Approved :: Mozilla Public License 2.0",
9+
"Operating System :: MacOS",
10+
"Operating System :: Microsoft :: Windows",
11+
"Operating System :: POSIX :: Linux",
12+
"Programming Language :: Python :: 3",
13+
"Programming Language :: Python",
14+
"Programming Language :: Rust",
15+
]

0 commit comments

Comments
 (0)