Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pyshifty

pyshifty is the Python package for Shifty, a SHACL validation and SHACL-AF inference engine for RDF graphs. Install the distribution as pyshifty and import it as shifty.

Documentation · Python API · Feature support

Install

pip install pyshifty

The core validation, inference, and evidence paths do not require rdflib. Install the extra when using validate() or an API that returns an rdflib.Graph:

pip install "pyshifty[rdflib]"

Python 3.9 or newer is supported. Published wheels include the Rust engine.

Validate

import shifty

shapes = """
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix ex: <http://example.org/> .

ex:PersonShape a sh:NodeShape ;
    sh:targetClass ex:Person ;
    sh:property [ sh:path ex:name ; sh:minCount 1 ] .
"""
data = """
@prefix ex: <http://example.org/> .
ex:alice a ex:Person ; ex:name "Alice" .
ex:bob a ex:Person .
"""

result = shifty.validate_algebra(data, shapes)
assert not result.conforms
for violation in result.violations:
    for reason in violation.reasons:
        print(violation.focus_node, reason.constraint_kind, reason.path)

# With the rdflib extra installed:
conforms, report_graph, results_text = shifty.validate(data, shapes)

The first call returns typed violations and reasons. The second returns a W3C sh:ValidationReport graph and text. Both take data first and shapes second. See validation interfaces for the reporting tradeoffs and the API reference for accepted arguments.

Inputs may be Turtle text or bytes, local paths, HTTP(S) URLs, pathlib.Path, or rdflib.Graph. Lists and tuples merge sources before evaluation. Omit the shapes argument when shapes and data are in one graph.

Infer

import shifty

rules = """
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix ex: <http://example.org/> .

ex:RectangleShape a sh:NodeShape ;
    sh:targetClass ex:Rectangle ;
    sh:rule [
        a sh:TripleRule ;
        sh:subject sh:this ;
        sh:predicate ex:area ;
        sh:object [ sh:path ex:width ] ;
    ] .
"""
rectangles = """
@prefix ex: <http://example.org/> .
ex:r1 a ex:Rectangle ; ex:width 3 .
"""

inferred = shifty.infer(rectangles, rules)
assert inferred.inferred_count == 1
print(inferred.inferred_ntriples)

inferred.graph_ntriples contains the input and derived triples. inferred.graph() returns that graph as rdflib.Graph when the extra is installed. See the inference guide for in-place updates and inference during validation.

Reuse shapes and inspect results

PreparedValidator(shapes) compiles a schema once for use with many data graphs. EvidenceSession records passing and failing focus nodes and their derivations. shape_map() extracts typed property bindings, including partial bindings for a focus node that fails another constraint. Symbolic repair is experimental. Start with the tutorials or look up these interfaces in the reference.

Develop from a checkout

From python/, use the locked uv environment:

uv sync --dev --frozen --reinstall-package pyshifty
uv run ruff check .
uv run ruff format --check .
uv run ty check shifty
uv run pytest -q

Reinstall after changing Rust sources so the editable extension is rebuilt. The contribution guide has the other frontend build instructions.

License

BSD-3-Clause.

Metadata

Release files for pyshifty 0.6.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyshifty 0.6.0a2
File Size Uploaded Provenance Actions
pyshifty-0.6.0a2.tar.gz 457.8 kB With provenance Details for pyshifty-0.6.0a2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyshifty 0.6.0a2
File Actions
pyshifty-0.6.0a2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for pyshifty-0.6.0a2-cp39-abi3-win_amd64.whl
pyshifty-0.6.0a2-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for pyshifty-0.6.0a2-cp39-abi3-musllinux_1_2_x86_64.whl
pyshifty-0.6.0a2-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for pyshifty-0.6.0a2-cp39-abi3-musllinux_1_2_aarch64.whl
pyshifty-0.6.0a2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for pyshifty-0.6.0a2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pyshifty-0.6.0a2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for pyshifty-0.6.0a2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pyshifty-0.6.0a2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for pyshifty-0.6.0a2-cp39-abi3-macosx_11_0_arm64.whl

Total release size: 25.9 MB

Release files / pyshifty-0.6.0a2.tar.gz

Download URL pyshifty-0.6.0a2.tar.gz
Size 457.8 kB
Tags Source
SHA-256 checksum
How to use checksums
de9e925d06c05f380d1503c88091b321e50565c2ca70f50085681de4c8fb3775
BLAKE2b-256 checksum
How to use checksums
67dfc1646f669d6b148be4bd338867f15bb5e2781d6b01c1dd770e1f356f38c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / pyshifty-0.6.0a2-cp39-abi3-win_amd64.whl

Download URL pyshifty-0.6.0a2-cp39-abi3-win_amd64.whl
Size 4.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b4e77d89a1b05d51b9e868b4e7d721efb8458e3c78313191f0a39c7de259383a
BLAKE2b-256 checksum
How to use checksums
ab143c82943f14142860ebdbd80e05072d60a29f4bea2fdac4357e8359295686
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / pyshifty-0.6.0a2-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pyshifty-0.6.0a2-cp39-abi3-musllinux_1_2_x86_64.whl
Size 4.4 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
7c770571637864dcde1510d3c204bfe67510e6f6456ea6e64b27e48c33113ae0
BLAKE2b-256 checksum
How to use checksums
2ded1766a9ac0939fd6f912d311d9b081fa9c8cb244a5a80b131add44695b48b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / pyshifty-0.6.0a2-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pyshifty-0.6.0a2-cp39-abi3-musllinux_1_2_aarch64.whl
Size 4.1 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
a93e2a0f21ef636f3bb5911e8053c670bbe77d7fbce70eeb4473661ffbd2dc7d
BLAKE2b-256 checksum
How to use checksums
a30f25492136158b261a44cd9b83a684abe88828a6de68edc94515630a0d7427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / pyshifty-0.6.0a2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pyshifty-0.6.0a2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.4 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
24bdd487da9fc9d6ee066736fefabb6a8381f0be98c3fc2c0f95112d38a6e912
BLAKE2b-256 checksum
How to use checksums
b09f9674329b793c32b6b6c1d6637e80f9fcdbb1ef75d75c6bb3735736d297b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / pyshifty-0.6.0a2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pyshifty-0.6.0a2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 4.1 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e5c6129cf4ebc9519927f2b156f9cc6a670abe9cbd4ed88cdf26d766dc79c61b
BLAKE2b-256 checksum
How to use checksums
25fd5b2af011e867099352cc57c31dd958b9d0f05c02c85cf968b0eb9ffebd9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / pyshifty-0.6.0a2-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyshifty-0.6.0a2-cp39-abi3-macosx_11_0_arm64.whl
Size 4.0 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
953f2ef3211a064540b8a039b889572427047b59c926393138f5feb7df07c7ef
BLAKE2b-256 checksum
How to use checksums
e3b4ff57731b49af8d215a3abb02e6a19186f2a46d5f191a302581299d70d13d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for pyshifty 0.6.0a2

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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for pyshifty-0.6.0a2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page