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.

Release files for pyshifty 0.5.0a3

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.5.0a3
File Size Uploaded
pyshifty-0.5.0a3.tar.gz 536.2 kB Details

Built distributions (wheels)

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

Total release size: 25.3 MB

Release files / pyshifty-0.5.0a3.tar.gz

Download URL pyshifty-0.5.0a3.tar.gz
Size 536.2 kB
Tags Source
SHA-256 checksum
How to use checksums
943772b56c0b8128dd8370370be061b14f35a860f94577678848d27e89b3b831
BLAKE2b-256 checksum
How to use checksums
ebfd2a9be4924f7769af695accfb9dd167daf73ec624ca33ff804b760a45f2d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / pyshifty-0.5.0a3-cp39-abi3-win_amd64.whl

Download URL pyshifty-0.5.0a3-cp39-abi3-win_amd64.whl
Size 4.3 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6e3812c0b3f775b01c3e7971f6a9f413ed155b95a58e0dc1c0e0f16eea98accd
BLAKE2b-256 checksum
How to use checksums
0e06dc45373d99c61df08333ee5f606a88fc69ff3b1cecf5fd68eb33f7c0ce86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / pyshifty-0.5.0a3-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pyshifty-0.5.0a3-cp39-abi3-musllinux_1_2_x86_64.whl
Size 4.3 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
3fed918a08a6e8e5892b432bc23e887f944a86451131067f072f00fa171229ad
BLAKE2b-256 checksum
How to use checksums
bb012404544601ac01d468f8ba8189d362e41381bfb45717af7d056cc694f70e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / pyshifty-0.5.0a3-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pyshifty-0.5.0a3-cp39-abi3-musllinux_1_2_aarch64.whl
Size 4.0 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
b4aa61bfc2ce1bdc1b0a09fde90967474a52fc15dcf8900484de1f841cd691ba
BLAKE2b-256 checksum
How to use checksums
6347180cca8736aefc93f9c453d89e0895717f7b95e405bcb60a0240b0585f69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / pyshifty-0.5.0a3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyshifty-0.5.0a3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.3 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
08b2245d453dae4861ecd56ec3159de5075d3d090a5092c871e7bc9c453db004
BLAKE2b-256 checksum
How to use checksums
638bba62fe4d3d33db8a520d56f55b89abbe7890c1024dd4c978f779316bfa13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / pyshifty-0.5.0a3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyshifty-0.5.0a3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 4.0 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
62d7629e3899e3225d8028978b607f5e6354ff1976e81fcbc1ac4c8c6673b697
BLAKE2b-256 checksum
How to use checksums
d0c870a431ad3182fda221e0ebc7eefe548c25a0f20339fe318fcebfe0daf88d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / pyshifty-0.5.0a3-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyshifty-0.5.0a3-cp39-abi3-macosx_11_0_arm64.whl
Size 3.9 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
55dccda4490b33f6a776833ba9226d4b37386a81b1963ed04b67bb7d1e2bbce8
BLAKE2b-256 checksum
How to use checksums
022433279839545262ad0a949177cc9e9b0ad1edcda4bb085273a76e07ba2633
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log
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