Skip to main content

Python bindings for the shifty validation engine

Project description

shifty Python bindings

This crate packages the shifty validator as a CPython extension using PyO3. It exposes the shifty module for RDFlib-centric workflows while reusing the same Rust engine that powers the CLI.

Installation

From PyPI (package name pyshifty, import name shifty):

pip install pyshifty

From the repository root you can develop locally with

cd python
uv sync  # or `pip install -r requirements.txt` if you prefer
uvx maturin develop --extras rdflib --release

The GitHub Actions workflow (.github/workflows/python.yml) publishes the package to PyPI as pyshifty and uses this README as the long description, so keep it up to date when the bindings change.

Usage

The extension exports one-shot helpers plus a CompiledShapeGraph cache that mirrors the CLI subcommands:

import shifty

# Validation. When you request diagnostics, a fourth element is returned.
conforms, results_graph, report_text, diag = shifty.validate(
    data_graph,
    shapes_graph,
    run_inference=True,
    inference={"min_iterations": 1, "max_iterations": 8},
    graphviz=True,
    heatmap=True,
    trace_events=True,
    return_inference_outcome=True,
)
print(diag["graphviz"])        # DOT for the shapes graph
print(diag["heatmap"])         # DOT for the execution heatmap
print(diag["trace_events"][0]) # First trace event (dict)
print(diag["inference_outcome"])

# Inference-only. Diagnostics are returned as a second element when requested.
inferred_graph, diag = shifty.infer(
    data_graph,
    shapes_graph,
    min_iterations=1,
    max_iterations=4,
    graphviz=True,
    union=True,
    return_inference_outcome=True,
)
print(diag["inference_outcome"]["triples_added"])

# Cache shapes once, then reuse them across datasets.
compiled = shifty.generate_ir(
    shapes_graph,
    skip_invalid_rules=True,
    warnings_are_errors=False,
    do_imports=True,
)
conforms, _, _, diag = compiled.validate(data_graph, run_inference=True)
print("Compiled cache conforms?", conforms)

Key options (mirroring the CLI flags):

  • skip_invalid_rules (default: False), warnings_are_errors, do_imports
  • Inference knobs: min_iterations, max_iterations, run_until_converged/no_converge, error_on_blank_nodes, debug, union (include original data); the inference={...} dict still works and aliases like inference_min_iterations remain.
  • Diagnostics: graphviz (DOT for shapes), heatmap + heatmap_all (execution heatmap, triggers a validation pass), trace_events, trace_file, trace_jsonl, return_inference_outcome (adds iteration/insert counts).

If you omit all diagnostics, validate returns (conforms, results_graph, report_text) and infer returns the inferred rdflib.Graph just like before.

See example.py and brick.py in this directory for full RDFlib/OntoEnv examples.

Docs

Sphinx docs live in python/docs. Build them with:

cd python/docs
make html

The build writes llms.txt into the HTML output directory (python/docs/_build/html/llms.txt).

Packaging notes

  • Cargo.toml declares readme = "README.md", so this file must be checked into the repo.
  • The sdist job in GitHub Actions uses the same path when stamping metadata via maturin.
  • Any new runtime assets (fixtures, schemas, etc.) should be listed in pyproject.toml under tool.maturin.sdist.include so they reach PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyshifty-0.0.7.tar.gz (280.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyshifty-0.0.7-cp313-cp313t-win_amd64.whl (6.5 MB view details)

Uploaded CPython 3.13tWindows x86-64

pyshifty-0.0.7-cp313-cp313t-musllinux_1_2_x86_64.whl (95.5 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ x86-64

pyshifty-0.0.7-cp313-cp313t-musllinux_1_2_aarch64.whl (94.6 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ ARM64

pyshifty-0.0.7-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (95.7 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ x86-64

pyshifty-0.0.7-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (94.9 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ ARM64

pyshifty-0.0.7-cp313-cp313t-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.13tmacOS 11.0+ ARM64

pyshifty-0.0.7-cp311-abi3-win_amd64.whl (6.6 MB view details)

Uploaded CPython 3.11+Windows x86-64

pyshifty-0.0.7-cp311-abi3-musllinux_1_2_x86_64.whl (95.4 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

pyshifty-0.0.7-cp311-abi3-musllinux_1_2_aarch64.whl (94.6 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

pyshifty-0.0.7-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (95.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

pyshifty-0.0.7-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (94.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pyshifty-0.0.7-cp311-abi3-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file pyshifty-0.0.7.tar.gz.

File metadata

  • Download URL: pyshifty-0.0.7.tar.gz
  • Upload date:
  • Size: 280.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyshifty-0.0.7.tar.gz
Algorithm Hash digest
SHA256 678a7d2ecaeb008c051dad38fd12e83f21d29ff4936e7f87e0b357ea1992b71c
MD5 76db6c45e88a4d68ee9b8bf792097688
BLAKE2b-256 7bc328d0d273179d95543f4d32943381c5e053e357067b56d92fab6d0bc66dd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7.tar.gz:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp313-cp313t-win_amd64.whl.

File metadata

  • Download URL: pyshifty-0.0.7-cp313-cp313t-win_amd64.whl
  • Upload date:
  • Size: 6.5 MB
  • Tags: CPython 3.13t, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyshifty-0.0.7-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 53a21f986e87fdebb66aba6311881d34c049a1a41733ce4c76454d7332a6d524
MD5 4e8a76f3d789a50d196f61fccb1dd11a
BLAKE2b-256 53114671ca1c6682fe71f547abb0cfbc363598412f4086d3ef68a422667500c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp313-cp313t-win_amd64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp313-cp313t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp313-cp313t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d01cda959aa1b2e195e57bc22411faa8c0079c14601e81038336e82d1aa02d45
MD5 90dfc63399ac368320c83e62cb59b587
BLAKE2b-256 4a000020d5cd3bbbb5070b0c2ff88de8b50a957d258768292c06e3998bb33c9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp313-cp313t-musllinux_1_2_x86_64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp313-cp313t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp313-cp313t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 393f7577b641573f6e3b58b9a527fce1f01907354bfbb93541c88a73f8e390ff
MD5 8ba43a3e851230b1034422341499e8f7
BLAKE2b-256 5b9930b6d8c604a03a769594e1d8d79dae4352210354ab4cde03d6e340754fe7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp313-cp313t-musllinux_1_2_aarch64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ef860bfe16bb6a1e87efe61cd09857d08a7686a65bf1ae0a116a73e6c770b51
MD5 26504f278a31e616efb6972c2c5ad526
BLAKE2b-256 35d46cb40ca21cbeb83045c1d7c640846c493737231ff573afda49a7dda0e4ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e64dd89101bde59a42296f06efb6c3378a66112603b56c1bbffd49432e208f41
MD5 0424a1b2b02e3dda3d764d2f42b8b9aa
BLAKE2b-256 8a7e34d6e3451558021046f9baa347700706131970c8fdfb7fa29ba97042225a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp313-cp313t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp313-cp313t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfa27482a42982095081b89c7e809b5325962229d2d306ae0f513fbcdbbd77ee
MD5 60a052863ecbdf2da33b3073c505f423
BLAKE2b-256 9a8c3c684eebb450dff41f9d6d1ee9fe6276945c03566a0739377e01d430d281

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp313-cp313t-macosx_11_0_arm64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pyshifty-0.0.7-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.6 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyshifty-0.0.7-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d60fccc848d92c4e4e42994153069511ea8d153d0b6c3b42060c6fd89eae8138
MD5 3d7ab78d6e7c2ef4308225b670abfcc6
BLAKE2b-256 788e24c09407f3bb7d3fa0ea30bda67da295b10a51c360a8808acccbca33f65b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp311-abi3-win_amd64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 258d411a2086504e9bb6d8657635ce492df51e533ba315dc249ac63bc319d56d
MD5 75984e5b67d67e669b1ec9fa08139f78
BLAKE2b-256 889b03ab0f64d62c726429f965525d3d3b544e20155746fb1143d1bd1bd4a0a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp311-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7861c69e24bd3cbca5ae8873fe1f9398f30a74b1a34535f101a43e4b0bc4673f
MD5 eaf2cb8ec8050f0589cf5428e72e2ccc
BLAKE2b-256 e0f1897f630e2126390a8a4a56cfa7f359866482a8cfb91a89e10e4f7a32d260

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp311-abi3-musllinux_1_2_aarch64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c70adad585a7cc2cf384befa763b30f57909bca36a0d067a520d5b946e44b96
MD5 85083d4f6bf44e36e6c62e83eb099e58
BLAKE2b-256 69c6b36e18c9d75133cb6604a58f9ace43d41c3b2c5e7910ea2316c6fe0977e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 844ab77cb8fadef464d878f8c70ecb558b756808197e651499f8b2ccf0dce90b
MD5 8077e40e2847dbb3847d9d12989704b8
BLAKE2b-256 5eb53d2de2d3ca7f8057607e1d8fcfc3b592f28138307d8b02d034c3b3bda639

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyshifty-0.0.7-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.7-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 38f1535bf0bb2244ee8329f24e112795738853c34abf98fd01b5ba60984312b1
MD5 a8acd1e59e79ec005ae9071141c30285
BLAKE2b-256 d38f0c381b1cb7f24d2f330f86e64952d0dc5c35afcd15168dfdbd986f012e68

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.7-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on gtfierro/shifty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page