Skip to main content

corvus-json-schema-rs

A JSON Schema evaluator for Python (draft 4, 6, 7, 2019-09 and 2020-12) backed by the corvus-json-schema Rust crate, the Rust port of the Corvus.Text.Json V5 standalone evaluator. It has the same API as the pure-Python corvus-json-schema package, so either can be imported in place of the other.

  • Conformant: passes the JSON-Schema-Test-Suite (required, optional and optional/format, every draft) except draft4/optional/zeroTerminatedFloats.json, which the C# and Rust evaluators exclude (they read 1.0 as an integer), and all of the suite's annotation tests.
  • Fast: instances are read in place through CPython's C API (dicts, lists and strings are not copied), so validating a Python object costs the evaluation alone. Over the jsonschema-benchmark corpora it takes 0.35 of the pure package's time and 0.72 of jsonschema-rs's (geometric means); see the pure package's Performance section for the figures.
  • Every platform from one wheel per platform: the extension uses the stable ABI (abi3), so one wheel serves CPython 3.10 and every later version. Wheels are built for Linux (x86_64 and aarch64, glibc and musl), macOS (universal2: Intel and Apple silicon) and Windows (x64, and arm64 from Python 3.11, CPython's oldest arm64 Windows release), and CI tests each on its own platform.

Install

pip install corvus-json-schema-rs

Usage

import corvus_json_schema_rs as cjs

validate = cjs.compile({"type": "object", "required": ["id"], "properties": {"id": {"type": "integer"}}})
validate({"id": 3})                    # True: a value as json.loads produces it, read in place
validate.is_valid_json('{"id": "3"}')  # False: JSON text, parsed in Rust

compile takes the same options as the pure package (default_dialect, assert_format, formats, resolve_document, base_uri, entry_point, max_depth and the rest, as keywords or a CompileOptions), and three more: pattern_match_limit (below), and regex_edition and regex_unicode_version, the edition of ECMA-262 and the version of Unicode patterns are read with (by default ECMAScript 2020 for 2019-09 and 2020-12, which name it, today's for the drafts before them, and Unicode 17). And evaluate, JsonSchemaResultsCollector, ResultsLevel and collect_annotations work as they do there. Custom formats and document resolvers are Python callables, called from Rust.

What differs from the pure package:

  • The limits on regular expressions. Both packages have pattern_match_limit (the seconds one match of a pattern or patternProperties regular expression against one string may take, 1.0 unless given, and None or 0 turns it off), PatternMatchLimitError (the instance is then neither valid nor not valid) and PatternTooLargeError (a SchemaCompilationError). What is left between them:
    • The limit error has its message and no attributes here. In the pure package it has pattern, limit and most_characters.
    • The memory of a match: here a match of any pattern is abandoned when its backtracking stack reaches 1,048,576 entries (24 MB). The pure package bounds the length of the text for a pattern that the regex package runs (1,048,576 characters, and fewer for a pattern with groups that its engine keeps for every repetition). Both raise PatternMatchLimitError.
    • compile matches each pattern of patternProperties against the property names the schema declares, so it can raise PatternMatchLimitError here. The pure package's compile runs no match.
    • The limits of size are 1,048,576 bytes of pattern, 1,000 levels of groups and about 16,000 terms here. In the pure package they are 32,768 characters of pattern, 100 levels, 32,768 characters of the pattern as it is written for Python's engines, and 4,096 copies of what a count repeats.
    • The time of a match is counted by the clock in both. Here the engine runs every pattern it is given and looks at the clock as it goes. In the pure package a pattern that is proved to match in time proportional to the text has no limit, and for any other the error comes between nine tenths of the limit and about twice the limit.
    • format: regex has one rule in both: a text over a limit of reading is not valid, and any other is valid or not by the grammar, whatever it would cost to compile. The limits of reading are each package's own.
  • There is no generated source: no Validator.source and no generate_module.
  • is_valid_json(text) validates JSON text (str or bytes) without creating Python objects for it.
  • Subclasses of dict, list, str, int and float (an OrderedDict, a string enum) are read as their bases, and tuples as arrays.
  • Integers beyond 64 bits are compared as the nearest double, as by a JSON parser without arbitrary precision.
  • A string with a lone surrogate (which json.loads can produce) is read with U+FFFD in its place.

How it works

The crate compiles the schema once into its node graph and fail-fast plans (see src-rs/corvus-json-schema). The evaluator is generic over an Instance trait (a value shown as one of the six JSON kinds, with arrays and objects read in place). This package implements it over Python objects through the stable C API: a dict is walked with PyDict_Next and searched by scanning its keys (or, when large, by lookup), a string is read as the UTF-8 that CPython keeps with it (no copy for ASCII strings), and a list is read by index. Anything the reader cannot take exactly (a tuple, a key that is not a string, a lone surrogate, a number beyond a double, very deep nesting) makes the call convert the instance to a serde_json::Value and evaluate that instead, so results never depend on which path ran.

Building

pip install maturin
maturin develop --release   # into the active virtual environment
maturin build --release     # a wheel for this platform

The Rust toolchain is pinned in ../rust-toolchain.toml. The tests are tests/test_binding.py and, through --impl corvus_json_schema_rs, the pure package's suite and results tests.

License

Apache 2.0.

The package is built on the corvus-json-schema Rust crate, which matches patterns with the corvus-regex-ecma262 crate, whose Unicode tables are derived from the Unicode Character Database, which is under the Unicode License V3. THIRD-PARTY-NOTICES.txt has that notice, and the one of the regress crate, from whose tables those were written. The file is in the source distribution and in every wheel, beside LICENSE.

Metadata

Release files for corvus-json-schema-rs 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for corvus-json-schema-rs 0.2.1
File Size Uploaded Provenance Actions
corvus_json_schema_rs-0.2.1.tar.gz 220.8 kB With provenance Details for corvus_json_schema_rs-0.2.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for corvus-json-schema-rs 0.2.1
File Actions
corvus_json_schema_rs-0.2.1-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for corvus_json_schema_rs-0.2.1-cp310-abi3-win_arm64.whl
corvus_json_schema_rs-0.2.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for corvus_json_schema_rs-0.2.1-cp310-abi3-win_amd64.whl
corvus_json_schema_rs-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for corvus_json_schema_rs-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl
corvus_json_schema_rs-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for corvus_json_schema_rs-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl
corvus_json_schema_rs-0.2.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for corvus_json_schema_rs-0.2.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
corvus_json_schema_rs-0.2.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for corvus_json_schema_rs-0.2.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
corvus_json_schema_rs-0.2.1-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 10.12+ x86-64, macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64) Details for corvus_json_schema_rs-0.2.1-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Total release size: 14.4 MB

Release files / corvus_json_schema_rs-0.2.1.tar.gz

Download URL corvus_json_schema_rs-0.2.1.tar.gz
Size 220.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6a21b82b941c494c6beceb11f8f6c24647bd42f8bbe81ac5ca49ab610ec79c3d
BLAKE2b-256 checksum
How to use checksums
7d3b1727f91748539c963b95f159730b6f7050988fb5445a4bd0569a063feb01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / corvus_json_schema_rs-0.2.1-cp310-abi3-win_arm64.whl

Download URL corvus_json_schema_rs-0.2.1-cp310-abi3-win_arm64.whl
Size 1.6 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
fc8116ffb3c3bb5a30e96934a94ead8a62db9723007cda49c8a41293360872d2
BLAKE2b-256 checksum
How to use checksums
d8be0c26e8af977022e156a0935ab1e5bb7dcbd05b41f0b435465f3d8a444575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / corvus_json_schema_rs-0.2.1-cp310-abi3-win_amd64.whl

Download URL corvus_json_schema_rs-0.2.1-cp310-abi3-win_amd64.whl
Size 1.7 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ac6b78b3b9fb441ae592f2c336916cbb4b4d679c94dd04de88a3f050d189729b
BLAKE2b-256 checksum
How to use checksums
e37c94b503dd24f8d039b00f454778d4cb6dc3328339a1724710edfce5d01130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / corvus_json_schema_rs-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL corvus_json_schema_rs-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl
Size 2.1 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
43c0b7ad34e457ea5ce7f51522e2b500c3ea072e188a14be3315137ff6815a2e
BLAKE2b-256 checksum
How to use checksums
173f272928ca93c3aa04a4dd917febe418b57ce2735f5fb809723c65779a95d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / corvus_json_schema_rs-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL corvus_json_schema_rs-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl
Size 1.9 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
1aba73aee20f7a7469842cf8c785ada8502df955945e31b4f267fc1bd7c24bd8
BLAKE2b-256 checksum
How to use checksums
2cd7764661dbe2cafdd6669518ad1495b2f876a7291038928fef90f1cb16cc9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / corvus_json_schema_rs-0.2.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL corvus_json_schema_rs-0.2.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.8 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
e8d69b0046d456dcfb526c3cf7ff02564c21ec2de9e1485f69695f38da224352
BLAKE2b-256 checksum
How to use checksums
17c0737cfb87da87517a53cbff2d296ce5bdfb91f4e0eaff0f4e0f557e922564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / corvus_json_schema_rs-0.2.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL corvus_json_schema_rs-0.2.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.8 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5d7e7b20098f32ba3721c99bc0a952b08c3247391440417340d21879038e10bd
BLAKE2b-256 checksum
How to use checksums
c8b4490f89ccf587701129f80591451461f47d7225e1f189d4b8c0ee0a39290f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / corvus_json_schema_rs-0.2.1-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Download URL corvus_json_schema_rs-0.2.1-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 3.4 MB
Tags CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
774f7e2d6bd5772696767f631224a2a654cd99324b8ff9ef971c506cb0bd7131
BLAKE2b-256 checksum
How to use checksums
e66a468e711fde4b53a3073011856fa3d96ab342b634e8204c27c6791bbdb8dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for corvus-json-schema-rs 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for corvus_json_schema_rs-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page