renderdag
A Python port of Meta's sapling-renderdag Rust library for rendering directed acyclic graphs (DAGs) as text.
Renderers
ASCII — basic characters, compact:
o E merge commit
|\
o | D
| |
| o C branch
|/
o B
|
o A
ASCII Large — wider spacing, easier to read:
o E merge commit
|\
| \
o | D
| |
| o C branch
| /
|/
o B
|
o A
Box Drawing — Unicode line-drawing characters:
o E merge commit
├─╮
o │ D
│ │
│ o C branch
├─╯
o B
│
o A
Install
pip install renderdag
# or
uv add renderdag
Usage
from renderdag import Ancestor, GraphRowRenderer
renderer = GraphRowRenderer().output().build_box_drawing()
# Render rows top-down (most recent commit first)
print(renderer.next_row("C", [Ancestor.parent("B")], "o", "C latest"))
print(renderer.next_row("B", [Ancestor.parent("A")], "o", "B"))
print(renderer.next_row("A", [], "o", "A root"))
The API follows a row-at-a-time model: call next_row() for each node in topological order (heads first), passing the node identifier, its parents as Ancestor values, a glyph string, and a message. The renderer tracks column state and returns the formatted string for that row.
Ancestor types
Ancestor.parent(node)— direct parent (solid line)Ancestor.ancestor(node)— indirect ancestor (dotted line)Ancestor.anonymous()— unknown/missing parent (terminator~)
Builder options
# ASCII renderer
renderer = GraphRowRenderer().output().build_ascii()
# ASCII Large with taller rows
renderer = GraphRowRenderer().output().with_min_row_height(3).build_ascii_large()
# Box Drawing with square corners instead of curved
renderer = GraphRowRenderer().output().build_box_drawing().with_square_glyphs()
# Reserve a column for a node before it appears
renderer.reserve("some-node")
Development
just demo # see example output from all renderers
just test # run all tests
just test-fast # skip Rust cross-validation
just test-xval # run only Rust cross-validation
License
MIT. This is a derivative work of sapling-renderdag by Meta Platforms, Inc. See LICENSE for details.
Note: this library was created using LLMs.
Metadata
Release files for renderdag 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| renderdag-0.1.1.tar.gz | 8.4 kB | Without provenance | Details for renderdag-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| renderdag-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for renderdag-0.1.1-py3-none-any.whl |
Total release size: 20.8 kB
Release files / renderdag-0.1.1.tar.gz
| Download URL | renderdag-0.1.1.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc474583ab450c155c788d07bd6e5400c81105a787e13f720d42496b90fe8f5b
|
|
BLAKE2b-256 checksum How to use checksums |
36806d8316097b96553402943adc0dc2c32f23ed1c2ea435431cafd98de648e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / renderdag-0.1.1-py3-none-any.whl
| Download URL | renderdag-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89f67da5e045e42a08b7e7c4024a4601467ae68b4280d5187bdbc7f04084c95a
|
|
BLAKE2b-256 checksum How to use checksums |
64293ac771a191bd0509d988941ac21e77752e27e05309a0927c4e0b5e510dd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for renderdag 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.