pyrudof - Python bindings for Rudof
pyrudof provides Python bindings for rudof,
a Rust library for Semantic Web operations.
At a high level it supports:
- Loading and serializing RDF and PG data.
- Loading, checking, serializing and validating ShEx schemas.
- Loading, serializing and validating SHACL shapes.
- Loading, serializing and validating PGSchemas.
- Loading, running and serializing SPARQL queries and query results.
- Converting and comparing schemas between supported formats.
- Loading and serializing DCTAP and Service Descriptions.
- Generating synthetic data from schemas.
Installation
Install from PyPI (recommended)
pip install pyrudof
pyrudof is built with PyO3 using abi3 wheels (Python 3.7+ compatible).
Build from source
Building from source requires a working Rust toolchain and Python.
# Clone the repository
git clone https://github.com/rudof-project/rudof.git
cd rudof/python
# Optional but recommended: virtual environment
python -m venv .venv
# Linux/macOS:
source .venv/bin/activate
# Windows PowerShell:
# .\.venv\Scripts\Activate.ps1
# Build and install editable package
pip install maturin
pip install -e .
For a release wheel:
maturin build --release
pip install --force-reinstall target/wheels/pyrudof-*.whl
Architecture and package structure
Package layout
| Path | Purpose |
|---|---|
src/ |
Rust implementation of the Python bindings (Rudof, RudofConfig, generator APIs, enums, and error mappings). |
stubs/pyrudof/ |
Hand-maintained .pyi type stubs for static type checking and editor support. |
examples/ |
Runnable example scripts organized by category, plus examples.toml manifest metadata. |
tests/ |
Python unittest suite and manifest registry loader for example-based tests. |
docs/ |
Sphinx docs, including the examples page generator (generate_examples_doc.py). |
Cargo.toml / pyproject.toml |
Rust crate and Python build configuration (maturin + PyO3). |
Test architecture
Tests are dynamically generated from examples/examples.toml.
Each generated test:
- Executes the registered Python example as a subprocess.
- Asserts a zero exit code.
- Checks configured
expected_outputsubstrings (if any).
| Component | Purpose |
|---|---|
tests/test_examples.py |
Builds dynamic unittest.TestCase classes per category/example. |
tests/examples_registry.py |
Loads and validates examples/examples.toml entries. |
examples/examples.toml |
Single source of truth for metadata and category order. |
examples/**/*.py |
Executable example scripts run by tests and referenced by docs. |
Testing
All test commands are run from bindings/python/tests.
Run the full suite
cd bindings/python/tests
python -m unittest discover -vvv
Run a specific category or test
# All ShEx examples
python -m unittest test_examples.TestShexExamples -v
# All SHACL examples
python -m unittest test_examples.TestShaclExamples -v
# All data generation examples
python -m unittest test_examples.TestGenerateExamples -v
# A single example
python -m unittest test_examples.TestShexExamples.test_shex_validate_inline -v
Run skipped examples
Examples marked with skip_test = true in the manifest are skipped by default.
# Linux/macOS
RUN_SKIPPED_EXAMPLES=1 python -m unittest test_examples -v
# Windows PowerShell
$env:RUN_SKIPPED_EXAMPLES="1"; python -m unittest test_examples -v
Examples and documentation
The examples system is intentionally centralized:
examples/examples.tomlstores metadata (key,source_file,title,description,category,files,expected_output,skip_test).examples/**/*.pystores the executable code.tests/test_examples.pyanddocs/generate_examples_doc.pyboth read from that same manifest.
Available categories
| Category | Description |
|---|---|
rdf |
RDF loading, serialization, node inspection |
sparql |
SELECT / CONSTRUCT query workflows |
shex |
ShEx loading, validation, and serialization |
shacl |
SHACL loading, validation, extraction, serialization |
dctap |
DCTAP profile handling |
endpoint |
Service description examples |
generate |
Synthetic data generation APIs |
utility |
Config, resets, version, module/error helpers |
Add a new example
- Create a runnable script under
bindings/python/examples/(recommended: place it inside a category subfolder, for examplebindings/python/examples/shex/my_example.py). - Register it in
bindings/python/examples/examples.toml. - Run tests from
bindings/python/tests. - Regenerate and check docs in
bindings/python/docs.
Manifest template:
[[example]]
key = "my_example"
source_file = "shex/my_example.py"
title = "My Example"
description = "What this example demonstrates"
category = "shex" # rdf | sparql | shex | shacl | dctap | endpoint | generate | utility
files = { data = "person.ttl" } # optional referenced files
expected_output = ["Alice"] # optional substrings (can be empty list)
# skip_test = true # optional (network/special runtime)
Build docs locally
cd bindings/python/docs
python generate_examples_doc.py --update
python generate_examples_doc.py --check
python -m sphinx -b html . _build/html
Then open bindings/python/docs/_build/html/index.html.
Metadata
Release files for pyrudof 0.3.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyrudof-0.3.15-cp37-abi3-win_amd64.whl | CPython 3.7 | abi3 | Windows x86-64 | Details |
| pyrudof-0.3.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.7 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| pyrudof-0.3.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.7 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| pyrudof-0.3.15-cp37-abi3-macosx_11_0_arm64.whl | CPython 3.7 | abi3 | macOS 11.0+ ARM64 | Details |
| pyrudof-0.3.15-cp37-abi3-macosx_10_12_x86_64.whl | CPython 3.7 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 56.3 MB
Release files / pyrudof-0.3.15-cp37-abi3-win_amd64.whl
| Download URL | pyrudof-0.3.15-cp37-abi3-win_amd64.whl |
|---|---|
| Size | 10.6 MB |
| Tags | CPython 3.7 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
665448c36cfa09e897f83468a0f7bf3e6685caca7007e1657b37920ab4d3df38
|
|
BLAKE2b-256 checksum How to use checksums |
9b42044c03ad6ada6a171d251111284a136ce60641dbe79e853d1c93fc0a2d69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / pyrudof-0.3.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyrudof-0.3.15-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 11.9 MB |
| Tags | CPython 3.7 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3a809f88d8084902d93df8d01d4fec5fb585e1f79bba084d1658fbce373bad1b
|
|
BLAKE2b-256 checksum How to use checksums |
6bc6866d08841ce8555958ddece7295e3832e3eb43d227bfed751fd26b52d476
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / pyrudof-0.3.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyrudof-0.3.15-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 12.0 MB |
| Tags | CPython 3.7 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
185014ae962e0fd54b3eadf23148a4c75f00d85a2cc941a07d701033d793172e
|
|
BLAKE2b-256 checksum How to use checksums |
7a89a5cfc0032ba31a0d9c294415483bacb3a1a68d7eef538a40b52a40d9ffec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / pyrudof-0.3.15-cp37-abi3-macosx_11_0_arm64.whl
| Download URL | pyrudof-0.3.15-cp37-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 10.7 MB |
| Tags | CPython 3.7 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d5568ed650c4baaf7d73b90f6668185bbadb50a7dc5b22dbe01e14be584d2bc7
|
|
BLAKE2b-256 checksum How to use checksums |
ba35922a71a61cd24dcb558f5efd77b9cad7a60375593da0af14d55c0c6d22cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / pyrudof-0.3.15-cp37-abi3-macosx_10_12_x86_64.whl
| Download URL | pyrudof-0.3.15-cp37-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | CPython 3.7 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a723d5918bf0e39acac5e9fb5859f25582aa74489170e18a65d38f20d5174c4b
|
|
BLAKE2b-256 checksum How to use checksums |
52d7136211e69e2bdfb10d430bf550fdcaf267ae5e826837f2a34f207b420ce7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|