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.8.tar.gz (286.8 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.8-cp313-cp313t-win_amd64.whl (6.6 MB view details)

Uploaded CPython 3.13tWindows x86-64

pyshifty-0.0.8-cp313-cp313t-musllinux_1_2_x86_64.whl (95.6 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ x86-64

pyshifty-0.0.8-cp313-cp313t-musllinux_1_2_aarch64.whl (94.7 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ ARM64

pyshifty-0.0.8-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (95.8 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ x86-64

pyshifty-0.0.8-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (95.0 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ ARM64

pyshifty-0.0.8-cp313-cp313t-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.13tmacOS 11.0+ ARM64

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

Uploaded CPython 3.11+Windows x86-64

pyshifty-0.0.8-cp311-abi3-musllinux_1_2_x86_64.whl (95.5 MB view details)

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

pyshifty-0.0.8-cp311-abi3-musllinux_1_2_aarch64.whl (94.7 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

pyshifty-0.0.8-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (95.8 MB view details)

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

pyshifty-0.0.8-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (95.0 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pyshifty-0.0.8-cp311-abi3-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pyshifty-0.0.8.tar.gz
  • Upload date:
  • Size: 286.8 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.8.tar.gz
Algorithm Hash digest
SHA256 4d611f33282645af28747b27a4a240cf18a68cec337ab34171bb2e13cd42437a
MD5 3a995c1bc6e3526318651ffd0ea500d7
BLAKE2b-256 30a293b255eb1f7b4caee15f32175024f53a4714bcf8766ae3fde2d98d4625bd

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyshifty-0.0.8-cp313-cp313t-win_amd64.whl
  • Upload date:
  • Size: 6.6 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.8-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 de95fcc83c184a63a3b6407380258d47e9c758127e405776c432c379576121c4
MD5 ed5b57ba36648e98a3ac1dd7f4198af7
BLAKE2b-256 28a50dabab29f0b58732a8f090c22a8c643dbed45f18c06b0bbdff75496708f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp313-cp313t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 87e86e1ab4558bccf373b714b24c95623391924aec95dca4045d3bd19bf1d31b
MD5 51324d01a46c843c7c62ac69d53a25b6
BLAKE2b-256 725475db69c6e815093121830e9b751342ee2ae69b9647b3b10f22c338a25e73

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp313-cp313t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 77f7ef904df3065f37e8f7ddbde1fa7513b814569a757f7313e73ea49b81777b
MD5 a26f9ea2187ede07ed096c24f7631333
BLAKE2b-256 9c9387b8593ca878cf6066aadc2ce9e0188fa3e69d222a804bcb7ef529ba2224

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.8-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.8-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 00bae9a9ead7c0894552893e0f5e9c5e0f853a6a9aaf65fe096b0f7ae3c126d0
MD5 c94707a1b27936976e3216bc804da35a
BLAKE2b-256 dc241b743e5b2ea3fe27c10c3736930ca18d9b0f43182ba8f37924a8eab0feaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.8-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.8-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be7dc608f402269fcf380ec12a4e84da3c3d2e779c926515898920c33bea96e4
MD5 5e0a4998712558a26fd7915e00457bbe
BLAKE2b-256 d4ef26c0e22167dee733cb65d0693f29092e4d5a92d8498c25f2c1786ba0819b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp313-cp313t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a0f19d8d1bb812af439f32dd8d909808a1f82831794a54a772d2f51f8936436b
MD5 fe65a528514c9fb4809346956f2db5c1
BLAKE2b-256 dc821346f9b129f95789cdadd2bb0352a27fd74d4cb804ac6db5a51667f74f1f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyshifty-0.0.8-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.8-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 39fec709b0e1c532c3fc3dbaeaf078c1132eb7f56e1dd510e1d197cf3ef83d3a
MD5 75e11413daff03ed7f494c3b6791d8b5
BLAKE2b-256 1b520a1d3760737a25a1a20e9d32ce2bc9f6961590c7696402aeea2c7253fd6e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 82594f0f35f2c065f95287bd5dd5463b60f45f8d6988ed9c996d35526dacc40a
MD5 0834fccead5421efc5352b770eabb3aa
BLAKE2b-256 0d95299a42ff726013491e30d6445bd3a5cbb367c73dccffeed690064c72f7ff

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b636eacf0afa2e2873a8fbc437d5bb883fb6224b5639287743cc5844ec6ae937
MD5 af9a926ef05fc255502008ac5e2b1995
BLAKE2b-256 a5d0ae125bd9273ab0d9f188d9797991b40c201eef133e0efa231ffc322c9b3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.8-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.8-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c774cefbf04fd44953fda5e028ab1433f2ab02d9f3c6e1daa5e34b4ce74f1ad
MD5 504f3402b47d8c845d1fd93e360aca84
BLAKE2b-256 d51e19592e5f1ae65e7da52d57aa5801c3a255b9c769b2df9b355c45e83fec95

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyshifty-0.0.8-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.8-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b685e00a9de642c86a142aeb57337e1b435afd8f02851ab17b9184f238ddeaee
MD5 4a3ab624b17f105c89b4cf4154dcffd4
BLAKE2b-256 4637acf22ee7c1ed7a3f309a41cd08e22b0fb43927061bc640b83331891eaf1b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.8-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b16527a6d024c01a2ed946f08ec7cd56eb4062e69d91fb7505dfabce0a8e5160
MD5 f89cb4769cd999e7d3ee091acca0948c
BLAKE2b-256 8e73aad7610ff630e9e437fbc2ed657c49f6ca48a7bbe51bcbba08ec2c2918d7

See more details on using hashes here.

Provenance

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