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.0a1

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.0a1
File Size Uploaded Provenance Actions
pyshifty-0.6.0a1.tar.gz 455.0 kB With provenance Details for pyshifty-0.6.0a1.tar.gz

Built distributions (wheels)

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

Total release size: 25.9 MB

Release files / pyshifty-0.6.0a1.tar.gz

Download URL pyshifty-0.6.0a1.tar.gz
Size 455.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fe8d9cb8d63960087c914e60c797685301f4c4eadd5c172a0b479e381f30b8b6
BLAKE2b-256 checksum
How to use checksums
526e2dd4b4ba8093ef79fc71aeec37fa9bcf7381a1c69811e7831f932461fa5b
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.0a1-cp39-abi3-win_amd64.whl

Download URL pyshifty-0.6.0a1-cp39-abi3-win_amd64.whl
Size 4.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5a176f26f6d6817d7b67281a441e43823b5bc83eb999aee25ca2a218f0c7fa20
BLAKE2b-256 checksum
How to use checksums
da75a08e27b9c1f6d2cf72857ae23aa1780c3f00aeb78fb67d540c35afe68b9c
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.0a1-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pyshifty-0.6.0a1-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
85d032292df7439ab92427725e641034947b1f8b9dc9531c9eb6e895cba1df5d
BLAKE2b-256 checksum
How to use checksums
f140aa9f1d84ea45bf2ce01410b537b20cc48cee1edb241502e58f7b4d0a6e1d
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.0a1-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pyshifty-0.6.0a1-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
8ef1816fe655a7462810934889a1f0ef11739038e8ba24e9af69b11b20722a4d
BLAKE2b-256 checksum
How to use checksums
0d8596dde607b58bd3391ce39cf7c509f4d18582fffd91fea72f4a7c4f7b1a52
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.0a1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pyshifty-0.6.0a1-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
f517d3dd5646512266a4043985a23cac1db242606aaa17cf8ae1de49584b4a47
BLAKE2b-256 checksum
How to use checksums
4598900c8f1ba9fe63f8397f55c475899ef299bb130be428f631ef09e800a0f8
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.0a1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pyshifty-0.6.0a1-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
949974f27bc011a00f5af1d9b912894c60806864c165893aac13d4f2ba64331d
BLAKE2b-256 checksum
How to use checksums
abecab691121a572d388a255523b93ed243d60d5b18b1875a3f66ba3cf625530
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.0a1-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyshifty-0.6.0a1-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
246465c8302ada2f8ccf1901c2eae3b4badf46ba4a720618ebff12427181cb97
BLAKE2b-256 checksum
How to use checksums
c056f457b13e31b150f467c26ecd713024c04a8979cfb4ee3649046467d25e88
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.0a1

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.0a1.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