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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyrudof-0.3.7-cp37-abi3-win_amd64.whl (9.9 MB view details)

Uploaded CPython 3.7+Windows x86-64

pyrudof-0.3.7-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ x86-64

pyrudof-0.3.7-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (11.2 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

pyrudof-0.3.7-cp37-abi3-macosx_11_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

pyrudof-0.3.7-cp37-abi3-macosx_10_12_x86_64.whl (10.4 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

Details for the file pyrudof-0.3.7-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: pyrudof-0.3.7-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for pyrudof-0.3.7-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 90e8f72995c5f33b62820a041b67020be74ec7d309c7a4fec88b7be288346d7d
MD5 eabcc3ca65ef4a2b58e64bf4cc741c71
BLAKE2b-256 c01c5ee83a09d8ffed6c4f25ad38c5dc756e62a4316db736a2ec3f2438d31361

See more details on using hashes here.

File details

Details for the file pyrudof-0.3.7-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyrudof-0.3.7-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99e810f93cf155a85c6ffd7f72731dbcd730c5d1265893f6eafe53f098c91537
MD5 b5fb4190af7ab6a0669963fde76a1d1c
BLAKE2b-256 8d1cbc48a6aea67554b808f48da2c2635558a7a16e2483dbec4a82c2bff375c1

See more details on using hashes here.

File details

Details for the file pyrudof-0.3.7-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyrudof-0.3.7-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cf867f6c938b920c5742053a7795dd397c64f2cb9a2b8bb64693284318627d04
MD5 2ad7b51995021b044789e721b01d251b
BLAKE2b-256 822189bf97a23ce6d41f4497c7af177522622192e58a6e351f8f3f58f3c770f6

See more details on using hashes here.

File details

Details for the file pyrudof-0.3.7-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyrudof-0.3.7-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a82fcded504782b898d06c3cb7849e327026270be3c075684dfe75d9ea5db8e
MD5 ff46dc6afd8396f9b1995e97a3931586
BLAKE2b-256 ccf96bb24aa1a7847c029b066363879d319760ef2ee6a835fff6a67c5f6fd11d

See more details on using hashes here.

File details

Details for the file pyrudof-0.3.7-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyrudof-0.3.7-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a98126be8afbf58180e9c73d8690e6eca05bfd0c464dbfb483d9b84d9694be8c
MD5 400f12c926f23142dfabd768f6ec4366
BLAKE2b-256 39469223be30ba53fa675510434a8b93f7fa9c0f3a87d28aced2a21b3c09afea

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.14

5 files

0.3.12

5 files

0.3.11

5 files

0.3.10

5 files

0.3.9

5 files

0.3.8

5 files

This release

0.3.7 This release

5 files

0.3.6

5 files

0.3.5

5 files

0.3.3

5 files

0.3.2

5 files

0.3.1

5 files

0.2.20

5 files

0.2.19

5 files

0.2.18

5 files

0.2.17

5 files

0.2.16

5 files

0.2.15

5 files

0.2.14

5 files

0.2.12

5 files

0.2.9

5 files

0.2.7

5 files

0.2.6

5 files

0.2.2

5 files

0.1.142

5 files

0.1.141

5 files

0.1.140

5 files

0.1.138

5 files

0.1.137

5 files

0.1.136

5 files

0.1.135

5 files

0.1.134

5 files

0.1.132

5 files

0.1.131

5 files

0.1.130

5 files

0.1.129

5 files

0.1.128

5 files

0.1.127

5 files

0.1.126

5 files

0.1.125

5 files

0.1.124

5 files

0.1.121

5 files

0.1.120

5 files

0.1.119

5 files

0.1.118

5 files

0.1.117

5 files

0.1.116

5 files

0.1.115

5 files

0.1.114

5 files

0.1.113

5 files

0.1.108

5 files

0.1.106

5 files

0.1.102

5 files

0.1.101

4 files

0.1.100

4 files

0.1.99

4 files

0.1.96

4 files

0.1.95

4 files

0.1.94

4 files

0.1.93

4 files

0.1.92

4 files

0.1.90

4 files

0.1.86

4 files

0.1.83

6 files

0.1.82

6 files

0.1.79

6 files

0.1.60

6 files

0.1.58

6 files

0.1.57

6 files

0.1.56

7 files

0.1.55

6 files

0.1.54

6 files

0.1.53

6 files

0.1.52

6 files

0.1.51

6 files

0.1.50

6 files

0.1.49

6 files

0.1.48

6 files

0.1.47

6 files

0.1.46

6 files

0.1.45

6 files

0.1.44

6 files

0.1.41

6 files

0.1.40

6 files

0.1.39

6 files

0.1.36

6 files

0.1.30

6 files

0.1.26

6 files

0.1.20

6 files

0.1.19

6 files

0.1.17

6 files

0.1.16

6 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