Skip to main content

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:

  1. Executes the registered Python example as a subprocess.
  2. Asserts a zero exit code.
  3. Checks configured expected_output substrings (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.toml stores metadata (key, source_file, title, description, category, files, expected_output, skip_test).
  • examples/**/*.py stores the executable code.
  • tests/test_examples.py and docs/generate_examples_doc.py both 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

  1. Create a runnable script under bindings/python/examples/ (recommended: place it inside a category subfolder, for example bindings/python/examples/shex/my_example.py).
  2. Register it in bindings/python/examples/examples.toml.
  3. Run tests from bindings/python/tests.
  4. 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.17

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

Built distributions (wheels)

Table of built distributions (wheels) for pyrudof 0.3.17
File
pyrudof-0.3.17-cp37-abi3-win_amd64.whl CPython 3.7 abi3 Windows x86-64 Details
pyrudof-0.3.17-cp37-abi3-manylinux_2_34_x86_64.whl CPython 3.7 abi3 Linux glibc 2.34+ x86-64 Details
pyrudof-0.3.17-cp37-abi3-manylinux_2_34_aarch64.whl CPython 3.7 abi3 Linux glibc 2.34+ ARM64 Details
pyrudof-0.3.17-cp37-abi3-macosx_13_0_x86_64.whl CPython 3.7 abi3 macOS 13.0+ x86-64 Details
pyrudof-0.3.17-cp37-abi3-macosx_13_0_arm64.whl CPython 3.7 abi3 macOS 13.0+ ARM64 Details

Total release size: 97.9 MB

Release files / pyrudof-0.3.17-cp37-abi3-win_amd64.whl

Download URL pyrudof-0.3.17-cp37-abi3-win_amd64.whl
Size 18.3 MB
Tags CPython 3.7 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3b57208b7e8e29904d511258f60d4772412165805088a9010895870486cda482
BLAKE2b-256 checksum
How to use checksums
b3d4728eca6855d98c7e4ca2cf5adc27557a04f2795f8281197fdf447c6f2458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / pyrudof-0.3.17-cp37-abi3-manylinux_2_34_x86_64.whl

Download URL pyrudof-0.3.17-cp37-abi3-manylinux_2_34_x86_64.whl
Size 23.6 MB
Tags CPython 3.7 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
2bce45ae1d7ff716a19542c0a8fd16804f58d493eb3a388a53eca5f6b4771466
BLAKE2b-256 checksum
How to use checksums
9d4c5095ae07b24fd0ef172cf14a7547df83d338179d60ad8ec6c8eeb9630af7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / pyrudof-0.3.17-cp37-abi3-manylinux_2_34_aarch64.whl

Download URL pyrudof-0.3.17-cp37-abi3-manylinux_2_34_aarch64.whl
Size 23.3 MB
Tags CPython 3.7 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
5a1ca6fe103949007d66dd417b67ff367ada4da18657482facccb4ac06230ce8
BLAKE2b-256 checksum
How to use checksums
abe4710d0abce999f3fcf679b5f147cea09ff90eeaade121a2cd6bbc39d1642a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / pyrudof-0.3.17-cp37-abi3-macosx_13_0_x86_64.whl

Download URL pyrudof-0.3.17-cp37-abi3-macosx_13_0_x86_64.whl
Size 16.7 MB
Tags CPython 3.7 abi3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
64c082353a9de2038f1180c534586279c1bc43d086a67d3ca6ed8d804621bd04
BLAKE2b-256 checksum
How to use checksums
070a4968e9bf779dc44a2fc025753e6325a84053670497895c5162d2c52a5a20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / pyrudof-0.3.17-cp37-abi3-macosx_13_0_arm64.whl

Download URL pyrudof-0.3.17-cp37-abi3-macosx_13_0_arm64.whl
Size 15.9 MB
Tags CPython 3.7 abi3 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
7e0175a04df03845abb40726357c6eb795f4d72d74ef1f43d409ac88eb4b1df4
BLAKE2b-256 checksum
How to use checksums
a9be4ab0cd2a2ff824d3e6f25574794967a4a04ceb67d066ddd8eb100dda2406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

0.3.23

6 release files

0.3.22

6 release files

0.3.21

5 release files

0.3.20

5 release files

0.3.19

5 release files

This release

0.3.17 This release

5 release files

0.3.16

5 release files

0.3.15

5 release files

0.3.14

5 release files

0.3.12

5 release files

0.3.11

5 release files

0.3.10

5 release files

0.3.9

5 release files

0.3.8

5 release files

0.3.7

5 release files

0.3.6

5 release files

0.3.5

5 release files

0.3.3

5 release files

0.3.2

5 release files

0.3.1

5 release files

0.2.20

5 release files

0.2.18

5 release files

0.2.17

5 release files

0.2.16

5 release files

0.2.15

5 release files

0.2.14

5 release files

0.2.12

5 release files

0.2.9

5 release files

0.2.7

5 release files

0.2.6

5 release files

0.2.2

5 release files

0.1.99

4 release files

0.1.96

4 release files

0.1.95

4 release files

0.1.94

4 release files

0.1.93

4 release files

0.1.92

4 release files

0.1.86

4 release files

0.1.83

6 release files

0.1.82

6 release files

0.1.79

6 release files

0.1.60

6 release files

0.1.58

6 release files

0.1.57

6 release files

0.1.56

7 release files

0.1.55

6 release files

0.1.54

6 release files

0.1.53

6 release files

0.1.51

6 release files

0.1.50

6 release files

0.1.49

6 release files

0.1.48

6 release files

0.1.47

6 release files

0.1.46

6 release files

0.1.45

6 release files

0.1.44

6 release files

0.1.41

6 release files

0.1.40

6 release files

0.1.39

6 release files

0.1.36

6 release files

0.1.26

6 release files

0.1.19

6 release files

0.1.17

6 release files

0.1.16

6 release files

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