subsumes
JSON Schema inclusion for Python: does schema A accept every instance valid under schema B?
If it does, A subsumes B. Use it to check whether a new schema still accepts everything the old schema allowed, such as before you change the schema of stored records or of an API.
Unstable:
subsumesis still in beta. Until version 1.0, the API may change from one minor version to the next.
pip install subsumes
The package wraps the Rust library of the same name. It needs Python 3.12 or later and has no dependencies.
Usage
from subsumes import subsumes
new = {"type": "integer", "minimum": 0}
old = {"type": "integer"}
verdict = subsumes(new, old)
if not verdict:
print("no longer accepted:", verdict.counterexample) # -1
A schema is a Python object as json.load gives it, for JSON Schema draft 2020-12. With Pydantic, that is Model.model_json_schema().
A check returns one of two verdicts:
Yes: Every instance valid under B is also valid under A. As a condition it is true.No: Some instance is valid under B but invalid under A. It carries such an instance ascounterexample, and as a condition it is false.
from subsumes import No, Yes
match subsumes(new, old):
case Yes():
print("compatible")
case No(counterexample):
print("no longer accepted:", counterexample)
When the library cannot decide
A Yes and a No are returned only when certain. A check that the library cannot decide raises an UndecidedError, so it never passes for an answer:
UnsupportedError: The answer depends on a construct that the library does not model, such asuniqueItems. Itssideis"a"or"b", and itslocationsays where the construct is.BudgetError: The check ran out of its work budget. A larger one may decide it:subsumes(a, b, budget=100_000_000).UnrepresentableError: A does not subsume B, but the library found no counterexample that it can give, such as a number that a float does not hold exactly.
from subsumes import UndecidedError, subsumes
try:
compatible = bool(subsumes(new, old))
except UndecidedError as undecided:
print("could not decide:", undecided)
A schema that cannot be checked at all raises a SchemaError, which is a ValueError: it is no schema, it declares another dialect, a keyword has a value that the draft does not allow, or a reference resolves to nothing. A schema has to stand on its own, so one that is spread over several files is bundled into one first.
What is modelled
The README of the repository says how patterns, numbers and format are read, and which constructs are not supported.
Metadata
Release files for subsumes 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| subsumes-0.2.0.tar.gz | 231.9 kB | Without provenance | Details for subsumes-0.2.0.tar.gz |
Built distributions (wheels)
Total release size: 7.5 MB
Release files / subsumes-0.2.0.tar.gz
| Download URL | subsumes-0.2.0.tar.gz |
|---|---|
| Size | 231.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8545719526d299fd847a0a6872c0e770f7cd73fa841148f993c7938a246bcb3c
|
|
BLAKE2b-256 checksum How to use checksums |
5f39fd551f1077eafa1545fbd7e71346a7261405740c0e8da8ec1e5ad11d5d76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / subsumes-0.2.0-cp312-abi3-win_amd64.whl
| Download URL | subsumes-0.2.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 839.8 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
791ded519663e60652e28b7a75995001735094d5ac8cd47d03fa22fa7b60370b
|
|
BLAKE2b-256 checksum How to use checksums |
5d0ea3c736e3d8f72b13c07792f123fdcc985616fbdb636ce9eb22e1af92baf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / subsumes-0.2.0-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | subsumes-0.2.0-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b97bf1516c0c47f27a4f1d41e61e30f4937d75b51a9ca52d288fc61bda6ef76f
|
|
BLAKE2b-256 checksum How to use checksums |
617255016f65a08cb37dab296795ed0d6602fca26537d88fc556d0bd871a353c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / subsumes-0.2.0-cp312-abi3-musllinux_1_2_aarch64.whl
| Download URL | subsumes-0.2.0-cp312-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
9c2ab9af5688f68545f7ebf67cf52c06684a855f82e0b5e277675ec167219a91
|
|
BLAKE2b-256 checksum How to use checksums |
40bf8d81899d720623a7bca2ac38f0dd725cf7b14af7ec00e31fd23e22863634
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / subsumes-0.2.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | subsumes-0.2.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
01c71a060afd4003e654bc29291a997dcd992e89ab02af80c0e0107fc34d9bb4
|
|
BLAKE2b-256 checksum How to use checksums |
c51120a06a677be748e86669ae2702099230733c5c373a0c7d058558380a1b61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / subsumes-0.2.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | subsumes-0.2.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
9b87d56f54638089d305dd0a153b222fe1024d27857b1246ba8b92c0f46dd273
|
|
BLAKE2b-256 checksum How to use checksums |
74c1da9c604339490a16e6e8d423816b67c8ed89c1a5b2a2e276a777840189e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / subsumes-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | subsumes-0.2.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 917.2 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5573b10ec4e1ecbe9ba7dd2952bcd003aa0e8d8c8e3f223918767b1e46926355
|
|
BLAKE2b-256 checksum How to use checksums |
842a827a2b6ff47bb2bac4ca2065c85d29ea6772d575216d68b3116219067c0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / subsumes-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | subsumes-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 950.8 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
43f2ef83519f3c794726a8950b1b0cae5113dc3c986cfe353d6555a9f533e038
|
|
BLAKE2b-256 checksum How to use checksums |
6ab8981e75cf374630d8f82f5368aa3370400128eed68f6279a21aaf7a0e9074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for subsumes 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.