Skip to main content

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/

Metadata

Release files for rpiclang 0.11.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rpiclang 0.11.3
File Size Uploaded
rpiclang-0.11.3.tar.gz 630.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rpiclang 0.11.3
File Interpreter ABI Platform
rpiclang-0.11.3-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
rpiclang-0.11.3-cp39-abi3-manylinux_2_35_x86_64.whl CPython 3.9 abi3 Linux glibc 2.35+ x86-64 Details
rpiclang-0.11.3-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 19.6 MB

Release files / rpiclang-0.11.3.tar.gz

Download URL rpiclang-0.11.3.tar.gz
Size 630.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b74c2ef6e0edc302854522f20cf9c83f391ccaab3189b08c28b30276e3f9d269
BLAKE2b-256 checksum
How to use checksums
3b8446388e53a8899b6147f0395ecf0c32ac14a245eb063e435d9f8c4a1bc1e0
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 29, 2026.

Transparency log

Release files / rpiclang-0.11.3-cp39-abi3-win_amd64.whl

Download URL rpiclang-0.11.3-cp39-abi3-win_amd64.whl
Size 6.0 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
67709d05d137dd8f4dac68f50d2c4e97c4fa9e5bdbbe4fe528841b304751aefd
BLAKE2b-256 checksum
How to use checksums
fe5603be41050affa4d7622127a8372587f9fc6b7c8a4608c24aa7af4d6fcba2
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 29, 2026.

Transparency log

Release files / rpiclang-0.11.3-cp39-abi3-manylinux_2_35_x86_64.whl

Download URL rpiclang-0.11.3-cp39-abi3-manylinux_2_35_x86_64.whl
Size 6.8 MB
Tags CPython 3.9 Linux glibc 2.35+ x86-64 abi3
SHA-256 checksum
How to use checksums
f31df18ab0f928af5e24a17bdbd752299bab64064ffbabadf2148e370e68198f
BLAKE2b-256 checksum
How to use checksums
7848d8d6f65ca72438d8acee90431b64b59af9306cd6c7ae40df8ef3b61e3880
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 29, 2026.

Transparency log

Release files / rpiclang-0.11.3-cp39-abi3-macosx_11_0_arm64.whl

Download URL rpiclang-0.11.3-cp39-abi3-macosx_11_0_arm64.whl
Size 6.2 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4967bfcb77f91824d7e6d0de20f04dfbbcadf09ba68edbaf56cc69f3be7226af
BLAKE2b-256 checksum
How to use checksums
50a04c9a9949eee992e619947a2302e9ad2a63092bcc38d716144a8700d6f336
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 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.11.3 This release

4 release files

0.11.2

4 release files

0.11.1

4 release files

0.11.0

4 release files

0.10.0

4 release files

0.9.0

4 release files

0.8.1

4 release files

0.8.0

4 release files

0.7.1

4 release files

0.7.0

4 release files

0.6.2

4 release files

0.6.1

4 release files

0.6.0

4 release files

0.5.0

4 release files

0.4.1

4 release files

0.4.0

4 release files

0.3.0

4 release files

0.2.0

4 release files

0.1.1

4 release files

0.1.0

4 release files

0.0.2

4 release 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