Metadata-Version: 2.4
Name: pyprttl
Version: 1.0.1
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
Requires-Dist: pytest>=8 ; extra == 'test'
Provides-Extra: test
License-File: LICENSE
Summary: Python bindings for the prttl Turtle formatter
Keywords: rdf,turtle,formatter,pretty-printer,rust
Home-Page: https://github.com/rism-digital/pyprttl
Author-email: Andrew Hankinson <andrew.hankinson@gmail.com>
License-Expression: Apache-2.0
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/rism-digital/pyprttl
Project-URL: Issues, https://github.com/rism-digital/pyprttl/issues
Project-URL: Repository, https://github.com/rism-digital/pyprttl
Project-URL: Upstream, https://codeberg.org/elevont/prttl

# pyprttl

Python bindings for the Rust [`prttl`](https://codeberg.org/elevont/prttl) Turtle formatter.

## Installation

Python 3.11 or newer is required.

Install the published package from PyPI:

```sh
pip install pyprttl
```

If 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 pinned `prttl` dependency from its upstream git repository

To install from a local checkout:

```sh
pip install .
```

To install in editable mode for development:

```sh
uv sync --group dev
uv pip install -e '.[test]'
```

This creates `.venv/` and installs the build and test dependencies used by this
project.

## Building

Build an editable local extension module into the active virtual environment:

```sh
uv sync --group dev
.venv/bin/python -m maturin develop
```

Build a wheel:

```sh
uv sync --group dev
.venv/bin/python -m maturin build --release --locked --compatibility pypi
```

The wheel will be written to `target/wheels/`.

Build a source distribution:

```sh
uv sync --group dev
.venv/bin/python -m maturin sdist --out dist
```

## Testing

Run the test suite with:

```sh
.venv/bin/python -m pytest -q
```

## Usage

```python
import pyprttl

formatted = pyprttl.format_turtle("@prefix ex: <http://example.com/> . ex:s ex:p ex:o .")
```

The package is built with maturin.

