rpiclang (Python)
Python bindings for rpic — the pic graphics language rendered to SVG / PNG / PDF, with animation manifests.
pip install rpiclang # distribution name; you `import rpic`
import rpic
svg = rpic.render_svg('box "hi"; arrow; circle "x"')
open("out.png", "wb").write(rpic.render_png("box \"hi\"", scale=2.0))
open("out.pdf", "wb").write(rpic.render_pdf("box \"hi\""))
# circuit library (or write `copy "circuits"` in the source itself):
svg = rpic.render_svg('A:(0,0); B:(2,0)\nresistor(A,B)', circuits=True)
# TeX math labels, exactly like `rpic -t`:
svg = rpic.render_svg('box "$-\\frac{T}{2}$" fit', texlabels=True)
# the parsed bundle: svg + animation manifest + diagnostics + warnings
bundle = rpic.compile('box\nanimate last box with "pop"')
bundle["animations"] # [{"id": "s0", "effect": "pop", ...}]
bundle["diagnostics"] # lines emitted by pic `print`
bundle["warnings"] # structured warnings (ignored attributes, ...)
bundle["objects"] # per-object geometry: {"id": "s0", "kind": "box",
# "bbox": {x,y,w,h} | None, "line", "col", ...}
# (compile_json returns the same as a JSON string)
# `copy "file"` includes resolve relative to `base`:
svg = rpic.render_svg('copy "shim.pic"\nbox', base="path/to/dir")
# compiling untrusted source? fence or disable filesystem includes
# ("sandboxed" = only files inside `base`; "deny" = none at all;
# the embedded `copy "circuits"` library always works):
svg = rpic.render_svg(user_source, base="jobs/42", include_policy="sandboxed")
# you can also cap evaluator work for pasted/shared documents:
svg = rpic.render_svg(user_source, max_loop_iterations=10_000, max_shapes=50_000)
Compile errors raise rpic.CompileError (a ValueError subclass, so old
except ValueError code keeps working). str(exc) is the readable message;
exc.info is the structured diagnostic for editors:
try:
rpic.render_svg("bxo", circuits=True)
except rpic.CompileError as exc:
exc.info # {"message": ..., "line": 1, "col": 1, "end_col": 4,
# "file": None, "kind": "expected_token", "found": "`bxo`",
# "expected": "an object", "hint": "did you mean `box`?"}
Positions are always relative to your source — with circuits=True an
error on your line 1 reports line 1, and a problem inside a copy include
names it in info["file"] (None means your own input).
Test
maturin develop --release && pytest tests -q
Build
pip install maturin
cd bindings/python
maturin develop --release # installs into the current environment
# or: maturin build --release → wheels in target/wheels/
Release files for rpiclang 0.11.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rpiclang-0.11.2.tar.gz | 630.3 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rpiclang-0.11.2-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| rpiclang-0.11.2-cp39-abi3-manylinux_2_35_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.35+ x86-64 | Details |
| rpiclang-0.11.2-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 17.6 MB
Release files / rpiclang-0.11.2.tar.gz
| Download URL | rpiclang-0.11.2.tar.gz |
|---|---|
| Size | 630.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f1884f81becb0a0b0ffe34e662b355826844c22e94b8871f7ec9511cc85616a
|
|
BLAKE2b-256 checksum How to use checksums |
238b4618a7e08d3d623f5c018b961e18dbb0095074cf1ed3cc572b654fc9fd08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / rpiclang-0.11.2-cp39-abi3-win_amd64.whl
| Download URL | rpiclang-0.11.2-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
69fda6927890ea86fb27d82fdd33bb6594f1c9eba6b4a80de24ee6ab8c7bf527
|
|
BLAKE2b-256 checksum How to use checksums |
199199ba4a12083f509d421e505757369fbad4e0b69cce6027eda57e04528104
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / rpiclang-0.11.2-cp39-abi3-manylinux_2_35_x86_64.whl
| Download URL | rpiclang-0.11.2-cp39-abi3-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.9 Linux glibc 2.35+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
bddb860e24c2289f05840894b9859ab0b52288b49a5e37656c14c4fdd6171022
|
|
BLAKE2b-256 checksum How to use checksums |
e822aafa5a50f40028ce7b262e09cef9f08df7592167aa688bd6260f76e111ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / rpiclang-0.11.2-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | rpiclang-0.11.2-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
56f20543a569dc75424cc2e88faa45caf89a6e73c106b464c7c7ac55a3304aee
|
|
BLAKE2b-256 checksum How to use checksums |
fecafda5e703b7e70d4231900ebda2029b45de1019a19679f8e9576232b80d21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency log