From 4aa0ab26505061281e3381adede5e1ae596f41f8 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Fri, 11 Sep 2020 04:15:40 +0200 Subject: [PATCH] Bump canonical_json version to 0.2.0 --- Cargo.lock | 59 ++++++++++++++++++++++++++++++++++++++------- Cargo.toml | 4 +-- README.rst | 20 +++++++++------ tests/test_dumps.py | 4 +-- 4 files changed, 66 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0999ebd..1bf01b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "aho-corasick" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" +dependencies = [ + "memchr", +] + [[package]] name = "bitflags" version = "1.2.1" @@ -8,16 +17,18 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "canonical_json" -version = "0.1.0" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15363defae791f14f2022c383786ea40c180293428e7c7b136560f627d914b95" dependencies = [ - "log", + "regex", "serde", "serde_json", ] [[package]] name = "canonicaljson-rs" -version = "0.1.0" +version = "0.2.0" dependencies = [ "canonical_json", "pyo3", @@ -118,6 +129,12 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" version = "0.2.72" @@ -134,13 +151,10 @@ dependencies = [ ] [[package]] -name = "log" -version = "0.4.11" +name = "memchr" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if", -] +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "parking_lot" @@ -255,6 +269,24 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +[[package]] +name = "regex" +version = "1.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" + [[package]] name = "ryu" version = "1.0.5" @@ -315,6 +347,15 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "thread_local" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +dependencies = [ + "lazy_static", +] + [[package]] name = "unicode-xid" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index 4decf01..4a693a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "canonicaljson-rs" -version = "0.1.0" +version = "0.2.0" authors = ["Mathieu Leplatre "] edition = "2018" description = "Python bindings for canonical_json" @@ -14,7 +14,7 @@ crate-type = ["cdylib"] [dependencies] serde = "1.0" serde_json = "1.0" -canonical_json = { version = "0.1.0", path = "../canonicaljson-rs/" } +canonical_json = "0.2.0" [dependencies.pyo3] version = "0.11" diff --git a/README.rst b/README.rst index 0aaa38a..ff398f6 100644 --- a/README.rst +++ b/README.rst @@ -25,14 +25,6 @@ Usage * ``canonicaljson.dump(obj: Any, stream: IO) -> str`` -See Also -======== - -* https://github.com/Kinto/kinto-signer/blob/6.1.0/kinto_signer/canonicaljson.py -* https://searchfox.org/mozilla-central/rev/b2395478c/toolkit/modules/CanonicalJSON.jsm -* https://github.com/matrix-org/python-canonicaljson -* The code to build a ``serde_json::Value`` from a ``pyo3::PyObject`` was greatly inspired by Matthias Endler's `hyperjson `_ - Development =========== @@ -63,6 +55,18 @@ Update version in ``Cargo.toml`` and: maturin build maturin publish +See Also +======== + +* https://github.com/gibson042/canonicaljson-spec +* The code to build a ``serde_json::Value`` from a ``pyo3::PyObject`` was greatly inspired by Matthias Endler's `hyperjson `_ + +Other specs: + +* https://github.com/Kinto/kinto-signer/blob/6.1.0/kinto_signer/canonicaljson.py +* https://searchfox.org/mozilla-central/rev/b2395478c/toolkit/modules/CanonicalJSON.jsm +* https://github.com/matrix-org/python-canonicaljson + License ======= diff --git a/tests/test_dumps.py b/tests/test_dumps.py index 3487095..d0bddc0 100644 --- a/tests/test_dumps.py +++ b/tests/test_dumps.py @@ -12,12 +12,12 @@ (["b", 2, 1], '["b",2,1]'), (("on", "off"), '["on","off"]'), (1, "1"), - (3.14, "3.14"), + (3.14, "3.14E0"), (False, "false"), (True, "true"), ("s", '"s"'), ("é", '"\\u00e9"'), - (10.0**21, '1e+21'), + (10.0**21, '1E21'), ("1\n 2 \t \b\f", '"1\\n 2 \\t \\b\\f"'), ("\xff I ❤ testing", r'"\u00ff I \u2764 testing"'), (r" \" ", r'" \\\" "'),