Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

shacl (Python)

Python bindings for the SHACL validation engine, built with PyO3 and maturin.

Building

pip install maturin
cd crates/shacl-python
maturin develop --release      # build and install into the current venv
maturin build --release        # produce a wheel in target/wheels

The extension targets the stable ABI (abi3-py39), so one wheel serves every CPython from 3.9 upwards.

Usage

import shacl

# Compile once, validate many: shapes are fixed while data changes, and
# compiling is a meaningful share of a small run.
shapes = shacl.Shapes.from_file("shapes.ttl")
report = shapes.validate_file("data.ttl")

if not report.conforms:
    for r in report.results:
        print(r.severity, r.component, r.focus_node, r.value)

Report is truthy when the data conforms and len() gives the result count, so the common case reads plainly:

if shapes.validate_file("data.ttl"):
    print("ok")

For a one-off, or for a self-describing document that carries its own shapes:

shacl.validate("data.ttl")                  # shapes come from the data graph
shacl.validate("data.ttl", "shapes.ttl")

Turtle can also be passed directly, which is convenient for tests:

shapes = shacl.Shapes.from_turtle(shapes_text)
report = shapes.validate_turtle(data_text)

Notes

Terms are returned as strings in N-Triples syntax — <http://ex/a>, "42"^^<http://www.w3.org/2001/XMLSchema#integer> — rather than as objects. That keeps the binding free of a dependency on any particular Python RDF library; parse them with whichever one you already use.

Threading

A Shapes object is immutable and safe to share. Validation releases the GIL and clones the term store per run rather than locking a shared one, so concurrent callers do not serialise on each other.

Measured on stock CPython 3.14 with the GIL enabled — 16 validations of a 69k-triple graph through one shared Shapes:

threads throughput
1 7.8 runs/s
4 26.9 runs/s
8 27.8 runs/s

It plateaus at four because each validation already parses across threads internally, so the cores are busy either way.

Free-threaded builds

The module declares gil_used = false, so it will not force the GIL back on when imported into a free-threaded interpreter (python3.14t). Note that free-threading is a separate build, not something a version number brings: a stock 3.14 still reports sys._is_gil_enabled() == True.

There is little to gain from it here. The GIL is already released around the work, which is why the table above scales. Free-threading would only help code doing significant Python-level work in parallel as well — and it costs the single abi3 wheel, since abi3 is a no-op on free-threaded builds and PyO3 falls back to a version-specific one.

The report as RDF

SHACL defines the validation report as a graph — a sh:ValidationReport — not as a list of strings. The attributes above are a convenience for reading it from Python; serialize is what to hand to another RDF tool.

print(shapes.validate_file("data.ttl").serialize())
_:r0 a sh:ValidationReport ;
    sh:conforms false ;
    sh:result _:r1 .
_:r1 a sh:ValidationResult ;
    sh:focusNode <http://ex/a> ;
    sh:resultPath <http://ex/age> ;
    sh:resultSeverity sh:Violation ;
    sh:sourceConstraintComponent sh:DatatypeConstraintComponent ;
    sh:value "old" .

Metadata

Release files for shacl 0.31.0

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

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for shacl 0.31.0
File Size Uploaded Provenance Actions
shacl-0.31.0.tar.gz 384.4 kB With provenance Details for shacl-0.31.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for shacl 0.31.0
File Actions
shacl-0.31.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for shacl-0.31.0-cp39-abi3-win_amd64.whl
shacl-0.31.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for shacl-0.31.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
shacl-0.31.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for shacl-0.31.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
shacl-0.31.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for shacl-0.31.0-cp39-abi3-macosx_11_0_arm64.whl
shacl-0.31.0-cp39-abi3-macosx_10_13_x86_64.whl CPython 3.9 abi3 macOS 10.13+ x86-64 Details for shacl-0.31.0-cp39-abi3-macosx_10_13_x86_64.whl

Total release size: 13.7 MB

Release files / shacl-0.31.0.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL shacl-0.31.0.tar.gz
Size 384.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ea24e3cb565a5acf733eba6a47631b2ab4b8460ef76b18d5895b219aeaacbae2
BLAKE2b-256 checksum
How to use checksums
b0e6d8d9b9194173d8699f8d0d2ee0f27508ea6c3695603b0494156402ed8935
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 25, 2026.

Transparency log

Release files / shacl-0.31.0-cp39-abi3-win_amd64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL shacl-0.31.0-cp39-abi3-win_amd64.whl
Size 2.6 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8690686b8dcbb0a57cf32d4b57461dab9cbf46d1663cc89eae1a07a43fef6352
BLAKE2b-256 checksum
How to use checksums
a48b92a9d782fe3ff4edee3b9a21029b267a45dba52deb52432646fea1e1a874
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 25, 2026.

Transparency log

Release files / shacl-0.31.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL shacl-0.31.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 2.8 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2bfb12ed80dd5abccad58d034fe70d9210b042983390b94dcf1d406e669e2032
BLAKE2b-256 checksum
How to use checksums
9cb9efe81c0a9387831c0500c0d0eda056ab218ca2fe6ccda916040836839982
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 25, 2026.

Transparency log

Release files / shacl-0.31.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL shacl-0.31.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.7 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
92cee926ccad5248395c3c686c8813a763f3ec0ab123464db971af3a1f59c9d8
BLAKE2b-256 checksum
How to use checksums
3d83fdb350596276c835f2f8a17293e9af22ff722b3bd52b88b9a000cc07e825
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 25, 2026.

Transparency log

Release files / shacl-0.31.0-cp39-abi3-macosx_11_0_arm64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL shacl-0.31.0-cp39-abi3-macosx_11_0_arm64.whl
Size 2.5 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6ffc1b6f8816b75608bda295d4f1fb6580463f92f210e5486919876d9016130e
BLAKE2b-256 checksum
How to use checksums
b8bafe3646e09bc7c86cbd059cf3389cce686afd9bfcd23c4ec1c67da2643e90
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 25, 2026.

Transparency log

Release files / shacl-0.31.0-cp39-abi3-macosx_10_13_x86_64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL shacl-0.31.0-cp39-abi3-macosx_10_13_x86_64.whl
Size 2.6 MB
Tags CPython 3.9 abi3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
14a254e40a75cd31fdadbf7440f4eed147e90c5f4c26a6926f530658308041c1
BLAKE2b-256 checksum
How to use checksums
dab647c85de184d7b43fb06849daeec8f4d5290d0e9593537ca1b5f1974622ea
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 25, 2026.

Transparency log

Security for shacl 0.31.0

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.

Change of provenance

The repository and configuration that created this release differ from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Select from 6 files

Attestation for shacl-0.31.0.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 25, 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.

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