Python bindings for rpic — the pic graphics language → SVG/PNG/PDF with animation.
Project description
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, ...)
# (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")
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/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rpiclang-0.6.1.tar.gz.
File metadata
- Download URL: rpiclang-0.6.1.tar.gz
- Upload date:
- Size: 205.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b4a24ba8c69c3ecf7b6ae197e20fc6207dac4de7da61d5f49b73a88620e3142
|
|
| MD5 |
8972e3ec76396b9083adee7249759a06
|
|
| BLAKE2b-256 |
5b7a0dc86229f953da3452cdf7dc606b942eb4b129a78ea8beca201de404574b
|
Provenance
The following attestation bundles were made for rpiclang-0.6.1.tar.gz:
Publisher:
python.yml on milkway/rpic-lang
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rpiclang-0.6.1.tar.gz -
Subject digest:
3b4a24ba8c69c3ecf7b6ae197e20fc6207dac4de7da61d5f49b73a88620e3142 - Sigstore transparency entry: 2064781363
- Sigstore integration time:
-
Permalink:
milkway/rpic-lang@d3ce5a13a86e71dcc1d809590d17acff499cfd82 -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/milkway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@d3ce5a13a86e71dcc1d809590d17acff499cfd82 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rpiclang-0.6.1-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: rpiclang-0.6.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
334995c0a47e3ed4cc01b780900a4840d0e10a22ab66170e69de162ebb973064
|
|
| MD5 |
0d68562bcd4ccd7b56ad5d3e4cfc16f4
|
|
| BLAKE2b-256 |
e7594bdf394ed506439f5e7e3b91c07d852a6894a150069f5465d554f1138f8b
|
Provenance
The following attestation bundles were made for rpiclang-0.6.1-cp39-abi3-win_amd64.whl:
Publisher:
python.yml on milkway/rpic-lang
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rpiclang-0.6.1-cp39-abi3-win_amd64.whl -
Subject digest:
334995c0a47e3ed4cc01b780900a4840d0e10a22ab66170e69de162ebb973064 - Sigstore transparency entry: 2064781376
- Sigstore integration time:
-
Permalink:
milkway/rpic-lang@d3ce5a13a86e71dcc1d809590d17acff499cfd82 -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/milkway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@d3ce5a13a86e71dcc1d809590d17acff499cfd82 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rpiclang-0.6.1-cp39-abi3-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: rpiclang-0.6.1-cp39-abi3-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 5.7 MB
- Tags: CPython 3.9+, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f88b7bfd42ce93834102ce07225c823c6d9177f1318ff25a9bc5486eb8d5a8a
|
|
| MD5 |
34f52ff22e2027627168c7d6099347be
|
|
| BLAKE2b-256 |
fee0b8996a5bac43f049cc70483ca44bb811ac0c0131bfce0fea821eff3adad2
|
Provenance
The following attestation bundles were made for rpiclang-0.6.1-cp39-abi3-manylinux_2_35_x86_64.whl:
Publisher:
python.yml on milkway/rpic-lang
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rpiclang-0.6.1-cp39-abi3-manylinux_2_35_x86_64.whl -
Subject digest:
6f88b7bfd42ce93834102ce07225c823c6d9177f1318ff25a9bc5486eb8d5a8a - Sigstore transparency entry: 2064781395
- Sigstore integration time:
-
Permalink:
milkway/rpic-lang@d3ce5a13a86e71dcc1d809590d17acff499cfd82 -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/milkway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@d3ce5a13a86e71dcc1d809590d17acff499cfd82 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rpiclang-0.6.1-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: rpiclang-0.6.1-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
138f7728bcb9e7e55552a051066dfad4b7c901134138232606ea43aed901820b
|
|
| MD5 |
6444011da4e8af0020e0ae194750ab19
|
|
| BLAKE2b-256 |
6c3a085e0640d326474e77809ae29973aa38eea45a2e32b8622897352ef8fd72
|
Provenance
The following attestation bundles were made for rpiclang-0.6.1-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
python.yml on milkway/rpic-lang
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rpiclang-0.6.1-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
138f7728bcb9e7e55552a051066dfad4b7c901134138232606ea43aed901820b - Sigstore transparency entry: 2064781372
- Sigstore integration time:
-
Permalink:
milkway/rpic-lang@d3ce5a13a86e71dcc1d809590d17acff499cfd82 -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/milkway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@d3ce5a13a86e71dcc1d809590d17acff499cfd82 -
Trigger Event:
push
-
Statement type: