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,
    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; 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.

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

Uploaded CPython 3.13tWindows x86-64

pyshifty-0.0.5-cp313-cp313t-musllinux_1_2_x86_64.whl (92.8 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ x86-64

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

Uploaded CPython 3.13tmusllinux: musl 1.2+ ARM64

pyshifty-0.0.5-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (93.1 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ x86-64

pyshifty-0.0.5-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (92.6 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.13tmacOS 11.0+ ARM64

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

Uploaded CPython 3.11+Windows x86-64

pyshifty-0.0.5-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.5-cp311-abi3-musllinux_1_2_aarch64.whl (92.3 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

pyshifty-0.0.5-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (93.1 MB view details)

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

pyshifty-0.0.5-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (92.5 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pyshifty-0.0.5-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.5.tar.gz.

File metadata

  • Download URL: pyshifty-0.0.5.tar.gz
  • Upload date:
  • Size: 221.5 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.5.tar.gz
Algorithm Hash digest
SHA256 47d020b27f98aeabfbde86a2901c923f98b161d9dec4732f4c4081e94bac6b68
MD5 13f179ae1d1990c866391e34b493d24e
BLAKE2b-256 069c6b50a9439d37b2aa4f72b26936684412af47d873e9db59eeb9580f08491b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyshifty-0.0.5-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.5-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 be3c99e9f633be47f4fc12b91ab5934386f0e593ba94f8a87c5de8dac259bf70
MD5 c0630c2264def01dcac501e916104baf
BLAKE2b-256 74ca5cc96a1744d19e4bd64adc5f9c8f480189d7ca95c40ff08aaf58f357efdb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp313-cp313t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8f8ce114cc15c87129e6f004c4b8bc59c83994b307e027c2fc7a74c7c84c4a16
MD5 7c8ad19354ff58c284ab8bf3acad9c17
BLAKE2b-256 5ead3dc69deb65749598ee1a13a899dc2c4e1c1340eaa5420ea4f374e8a8f9b6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp313-cp313t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 c9113eee419509d933437fce2b3e0c132b9bc8c09815e0b5aa4be7798b246a75
MD5 2bb9ac6e997941c4dd6733143de0f10f
BLAKE2b-256 11be05b0df7186007ddbc72d62a98c2d54cc245d7c5d070444b44cae4855f594

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2802cece8ef3fd92bf722b5932130b82ab71e3d724e4133a0864fa31cd35c353
MD5 52304dde69e3eeeb721e25364af1c8e0
BLAKE2b-256 4e9e55f08f889d7487cb65f37ab834a6ae2b8cc909a32f803706b1fe71b5e4d1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f2ae3e537cc19d2afa2e92ebf8239a1e69ebd613165fd0d05c72b48b4200396b
MD5 28db6023a13e3f8a952f8bc56622df61
BLAKE2b-256 01d1918e8c79450bee11226096a56436631460c622f6046ec53d21ebacdfc0f3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp313-cp313t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ed2f22bd6abd6812a48f025e793c7d1f6dcdb9aaa2a8c48149635f1b7f9c018
MD5 c1be2417811538b164facc5872e61de1
BLAKE2b-256 19730670cb16bfc6f523e92c18faca0952a63789f8f5ff4eda58a2e6a602f8f6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyshifty-0.0.5-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.5-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b888705e47af2d193f33fc1b15eeae5bede8e540b41324a53d2408cabbc333f7
MD5 4b804075a23aa0e0b5790922a6d6ed06
BLAKE2b-256 823e778448f9b1ca2f21f5a02236f1f2d3ba805e93c51fa2fcdc6c9481afd9c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0d9cb4f933767dfa7f36a49766661bf41f8241fc3beede8c12cf1ad45f54eb6c
MD5 f48619c82c7fb482345553b68d6f835a
BLAKE2b-256 812494bd17bdbe2d615b5b510ceec4fddef09a366999004acd263ddc4249ea12

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 45beddab3a585f7200b0c075c5c17eddbabc76e395b3cfed691a869df9b816a1
MD5 377a9c1317cc94e87f3226323a12bed0
BLAKE2b-256 f6c0b0cef0a9ddfc537ed8cd720502430d403f1e425a3dfabb252585171bf483

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30307f8d02c9c234eb38c91459c6e0045c38a2192c585b65ad4c25b89f00f404
MD5 0ee8ebb0a9b20132da14bf4b83ccbe8e
BLAKE2b-256 c1ae5310e8e7cd5cb87c32f3106e5c8157f9fcc7dd9d65027ea8a6f2ec6c8b99

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 55207206a94226ed60c658058edb2155721d835011af6114bbf9148395e26f10
MD5 345e150ad4a505a22293d74aae34f64d
BLAKE2b-256 6ad5f3f12854111f1c320b12e65d4569c43204ec770ddc023785059998dd5795

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyshifty-0.0.5-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a8561f57604de3b9ba1074cb803bbffa609d3cf682675cdc1f874381b88d790
MD5 b05e7ee26b35098f20d73637193796b8
BLAKE2b-256 b632ad47e0c262432cb3666c67fe2c36106ef2b85bae09f2bdb04923b8912633

See more details on using hashes here.

Provenance

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