Python bindings for the Rust prttl Turtle formatter.
Python 3.11 or newer is required.
Install the published package from PyPI:
pip install pyprttlIf a wheel is not available for your platform, pip will build from source.
Source builds require:
- Python 3.11+
- a Rust toolchain with
cargo git, because Cargo fetches the pinnedprttldependency from its upstream git repository
To install from a local checkout:
pip install .To install in editable mode for development:
uv sync --group dev
uv pip install -e '.[test]'This creates .venv/ and installs the build and test dependencies used by this
project.
Build an editable local extension module into the active virtual environment:
uv sync --group dev
.venv/bin/python -m maturin developBuild a wheel:
uv sync --group dev
.venv/bin/python -m maturin build --release --locked --compatibility pypiThe wheel will be written to target/wheels/.
Build a source distribution:
uv sync --group dev
.venv/bin/python -m maturin sdist --out distRun the test suite with:
.venv/bin/python -m pytest -qimport pyprttl
formatted = pyprttl.format_turtle("@prefix ex: <http://example.com/> . ex:s ex:p ex:o .")The package is built with maturin.