rcl/pyrcl
Ruud van Asseldonk 676e975b43 Check "cargo doc --workspace" on CI
By making a flake check for it, so we can also check locally. This check
currently fails (because it was not enforced, so of course it broke).

And, what I learned the hard way, rebased here now:

We need to provide the full Rust sources, including generated
Tree-sitter files, and also we need to create $out when the check
passes. We can just put the docs there.
2025-09-02 23:24:54 +02:00
..
src Make document name configurable in the loader 2025-08-11 18:57:25 +02:00
Cargo.rcl Check "cargo doc --workspace" on CI 2025-09-02 23:24:54 +02:00
Cargo.toml Check "cargo doc --workspace" on CI 2025-09-02 23:24:54 +02:00
package_readme.md Tweak the Python package readme 2025-08-28 23:44:29 +02:00
pyproject.rcl Tweak the Python package readme 2025-08-28 23:44:29 +02:00
pyproject.toml Bump version to 0.10.0 2025-08-30 21:28:19 +02:00
rcl.pyi Test pyrcl in the Nix Flake and on CI 2024-02-01 23:50:05 +01:00
README.md Document published Python package in installation 2025-08-28 23:07:31 +02:00
test.py Test number representation in pyrcl tests 2025-02-25 22:21:39 +01:00
test.rcl Test pyrcl in the Nix Flake and on CI 2024-02-01 23:50:05 +01:00

RCL Python Module

This directory contains Python bindings for RCL, built with PyO3.

Building the module

Build the shared object, from the repository root:

cargo build --manifest-path pyrcl/Cargo.toml

Give the shared object the appropriate name for the Python interpreter to discover it:

mv target/debug/{librcl,rcl}.so

Tell Python where to find the shared object, run the interpreter:

PYTHONPATH=target/debug python3
>>> import rcl
>>> help(rcl.loads)
>>> rcl.load_file("examples/buckets.rcl")

Building a Python package

Maturin can build a Python wheel:

maturin build --manifest-path pyrcl/Cargo.toml

Maturin can also build a portable manylinux wheel. We automate this as part of the Nix flake:

nix build .#pyrcl-wheel --out-link result
uv run --with result/*.whl python
>>> import rcl
>>> rcl.loads("20 + 22")
42

The same flake attribute also contains an sdist archive. We publish them together to Pypi using Twine:

twine upload result/*