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.6.tar.gz (226.3 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.6-cp313-cp313t-win_amd64.whl (6.5 MB view details)

Uploaded CPython 3.13tWindows x86-64

pyshifty-0.0.6-cp313-cp313t-musllinux_1_2_x86_64.whl (92.9 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ x86-64

pyshifty-0.0.6-cp313-cp313t-musllinux_1_2_aarch64.whl (92.3 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ ARM64

pyshifty-0.0.6-cp313-cp313t-manylinux_2_28_x86_64.whl (93.1 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ x86-64

pyshifty-0.0.6-cp313-cp313t-manylinux_2_28_aarch64.whl (92.6 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

pyshifty-0.0.6-cp313-cp313t-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.13tmacOS 11.0+ ARM64

pyshifty-0.0.6-cp311-abi3-win_amd64.whl (6.5 MB view details)

Uploaded CPython 3.11+Windows x86-64

pyshifty-0.0.6-cp311-abi3-musllinux_1_2_x86_64.whl (92.8 MB view details)

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

pyshifty-0.0.6-cp311-abi3-musllinux_1_2_aarch64.whl (92.3 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

pyshifty-0.0.6-cp311-abi3-manylinux_2_28_x86_64.whl (93.1 MB view details)

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

pyshifty-0.0.6-cp311-abi3-manylinux_2_28_aarch64.whl (92.6 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

pyshifty-0.0.6-cp311-abi3-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pyshifty-0.0.6.tar.gz
  • Upload date:
  • Size: 226.3 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.6.tar.gz
Algorithm Hash digest
SHA256 54d77c43c266342d35d2cf338227e06d8428cd8082ad824a570814e2065289ea
MD5 4800e2fcb99c3852b4be4359a5b8dbfe
BLAKE2b-256 2fc90237603587696b33daea26fc6f295220041f333dc5cc5dca1a0bf1ab9b6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6.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.6-cp313-cp313t-win_amd64.whl.

File metadata

  • Download URL: pyshifty-0.0.6-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.6-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 d171d7a01b8451d7b97ac1849113df3e0fba606d79a4205a8e66549ad3552f43
MD5 2983823a61e795ea046c530423693658
BLAKE2b-256 5da5489f9faf7ebae090764a46336f645f0b62acfc753a984d68b0a8f69ba1b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-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.6-cp313-cp313t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp313-cp313t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f113d0ebe43bf2296f55135ef215dcabc3b4548c0474690426159f9d20da40db
MD5 e26e82de3f1a2f91d1904f5257947a8c
BLAKE2b-256 8f5aed8f5fe0c42542795e9d6c57b4b2111eb6e49d189ae4abc991f2b2c8329e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-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.6-cp313-cp313t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp313-cp313t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6a0421ba35c9fff7c155ff616a406bf1e2e609afbd4b2f7272b3a85abcb9f5e0
MD5 6b09fc4c2bfd2b44b3b0697d4f7e03c0
BLAKE2b-256 959540accc9c3ca4d24c9452aeaf0509351c52dc5c8a04f08dd703aa084376dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-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.6-cp313-cp313t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 36bf0587410ba4883e1a117f04a6b4e614de305147c13b3228facf3d7f6f7e4c
MD5 b670670c88ff39bdd8828917874d3f01
BLAKE2b-256 3085a03258752cebf22d1d1a483c399f08df4a6167a0d13b1041a7be6dd8b4db

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-cp313-cp313t-manylinux_2_28_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.6-cp313-cp313t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a8bb4e42b9b95c7ffcd8e326902566425a1475db0f6a0e55df3879f04637860e
MD5 d9ff8f05440f418cc019e6883eaaddbb
BLAKE2b-256 20a193751628c041699b76a517346905014a0d9d632664f262ab587c9a699856

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-cp313-cp313t-manylinux_2_28_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.6-cp313-cp313t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp313-cp313t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 911831f887b8023a0a1d8c96e1e259ccfa3a5be2dba2befe018fe39d6bd9beb0
MD5 8e1619703314cbad6978f81d7f871f7f
BLAKE2b-256 b2dd33228df75c3efbbca755bd8b3269d098c31cccc4b7a70115b71b5eae96d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-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.6-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pyshifty-0.0.6-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.5 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.6-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 eeb71f501feab21340e33b4f8ac8c4ba7a6bf7db24a16a6c3efd5aaff7afed77
MD5 ac8327b3112a002f2bed554254fea339
BLAKE2b-256 5a4269c4d1932569e1169be08f0d5e90b43df9b670023123cbf9e59d380d5e23

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-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.6-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9ceff9444a2f5c9a7e77789be7e31a2d480e58e8f58e207d35786e23f6dcdb2d
MD5 ba96fcf5de4c8993021fc40433a26b60
BLAKE2b-256 6274a3ddf76f4fda3c6117252cd0f4ab53452ecdec99b2f5a5fb85fd29bb07ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-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.6-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 edef75594c1639a35a887f0c41ff2c2050db0f232906fae1c6e457f7a2de029b
MD5 f453b5ea3928139172de28d8d451edf0
BLAKE2b-256 1a4f65019d5c79de0bfd9ac8e0f38dc1daa16a0939b7923a5c2c977c0c1a50ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-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.6-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c7efa37171f2e420b8d6054169981f5484e4f9281dbaa3bf07d89e3ea5fd8852
MD5 44a967ff4684bd5ba8b7278cde4af182
BLAKE2b-256 3e5717e370de70eac29a4fbc5c53ef2b9743fe8eaba836c14d5601298e75e5be

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-cp311-abi3-manylinux_2_28_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.6-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8c85269f517c3728ceafceb29e9070adb71231da5828c3ae4914f61726ee5d51
MD5 290d9b055add180c6afd7af07796fc3f
BLAKE2b-256 48d6218f079412ac08561ded0e0cb187312797e688fc83125dda5e366fde900e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-cp311-abi3-manylinux_2_28_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.6-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.6-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 405ed191cd4793d23bb8cf825093021b2cb334a2f98bd57de009ad670e406146
MD5 bda55a82b25fa54bea50b10b4c7b5085
BLAKE2b-256 49f45d12fe4fe9b12fd6a6ddb8424e97725663de4adb806d9e1fdf3777194860

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.6-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