compgraph2txt
A tiny library for visualizing computational graphs in the terminal.
│ │ │ ╭─────────╮
│ │ │ │ A │
│ │ │ ├─────────┤
│ ╰───┼→ a e ─┼─╮
│ │ │─ b f ─┼──→
├─────┼→ c g ─┼───╮
│ │ │─ d h ─│ │ │
│ │ │ i ─┼────→
│ │ ╰─────────╯ │ │
│ ╭───────────────╯ │
│ │ │ ╭─────────────╯
│ │ │ │ ╭─────────╮
│ │ │ │ │ Z │
│ │ │ │ ├─────────┤
│ ╰─────┼→ t x ─┼→
│ │ ╰─┼→ u y ─│
╰───────┼→ v z ─┼→
╰───┼→ w │
╰─────────╯
Source
from compgraph2txt import compgraph2txt
from networkx import MultiDiGraph
graph = MultiDiGraph()
graph.add_node(
"A", inputs=["a", "b", "c", "d"], outputs=["e", "f", "g", "h", "i"]
)
graph.add_node("Z", inputs=["t", "u", "v", "w"], outputs=["x", "y", "z"])
# Add edges from external sources
graph.add_edge("ext1", "A", input="c")
graph.add_edge("ext1", "Z", input="v")
graph.add_edge("ext2", "A", input="a")
graph.add_edge("ext3", "Z", input="w")
# Add edges to external sinks
graph.add_edge("A", "ext", output="f")
graph.add_edge("A", "ext", output="i")
graph.add_edge("Z", "ext", output="x")
graph.add_edge("Z", "ext", output="z")
graph.add_edge("Z", "ext", output="x")
graph.add_edge("Z", "ext", output="z")
# Add edges between nodes
graph.add_edge("A", "Z", output="e", input="t")
graph.add_edge("A", "Z", output="g", input="u")
print(compgraph2txt(graph))
Example: Image Background Blur Pipeline
Source
from compgraph2txt import compgraph2txt
from networkx import MultiDiGraph
graph = MultiDiGraph()
graph.add_node("Camera", inputs=[], outputs=["Image"])
graph.add_node("Foreground Detection", inputs=["Image"], outputs=["Foreground", "Background"])
graph.add_node("Blur", inputs=["Image"], outputs=["Blurred Image"])
graph.add_node("Image Overlay", inputs=["Foreground", "Background"], outputs=["Image"])
graph.add_node("Application", inputs=["Image"], outputs=[])
graph.add_edge("Camera", "Foreground Detection", output="Image", input="Image")
graph.add_edge("Foreground Detection", "Blur", output="Background", input="Image")
graph.add_edge("Blur", "Image Overlay", output="Blurred Image", input="Background")
graph.add_edge("Foreground Detection", "Image Overlay", output="Foreground", input="Foreground")
graph.add_edge("Image Overlay", "Application", output="Image", input="Image")
print(compgraph2txt(graph))
Output
╭──────────╮
│ Camera │
├──────────┤
│ Image ─┼─╮
╰──────────╯ │
╭────────────╯
│ ╭────────────────────────╮
│ │ Foreground Detection │
│ ├────────────────────────┤
╰─┼→ Image Foreground ─┼─╮
│ Background ─┼───╮
╰────────────────────────╯ │ │
╭────────────────────────────╯ │
│ ╭────────────────────────────╯
│ │ ╭────────────────────────╮
│ │ │ Blur │
│ │ ├────────────────────────┤
│ ╰─┼→ Image Blurred Image ─┼─╮
│ ╰────────────────────────╯ │
│ ╭────────────────────────────╯
│ │ ╭─────────────────────╮
│ │ │ Image Overlay │
│ │ ├─────────────────────┤
╰───┼→ Foreground Image ─┼─╮
╰─┼→ Background │ │
╰─────────────────────╯ │
╭───────────────────────────╯
│ ╭───────────────╮
│ │ Application │
│ ├───────────────┤
╰─┼→ Image │
╰───────────────╯
Metadata
Release files for compgraph2txt 1.0.0
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 |
|---|---|---|---|---|
| compgraph2txt-1.0.0.tar.gz | 10.3 kB | Without provenance | Details for compgraph2txt-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| compgraph2txt-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for compgraph2txt-1.0.0-py3-none-any.whl |
Total release size: 18.7 kB
Release files / compgraph2txt-1.0.0.tar.gz
| Download URL | compgraph2txt-1.0.0.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ddc615f68f7dbe1c23ffa9fd57e98b264118409f732a32da715f69fa9884514
|
|
BLAKE2b-256 checksum How to use checksums |
464ac04644fe0fff140dc34fdee460d2218df6602f89c62fd786cb9628fb13d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.3
|
Release files / compgraph2txt-1.0.0-py3-none-any.whl
| Download URL | compgraph2txt-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff62a16c930df4a612813a45a8c4ccc4432159059b2b5132b07b7652e42fac3d
|
|
BLAKE2b-256 checksum How to use checksums |
03c22f93d53312e8b1428ea0a6f72de3b215b0218c79e4a1fcfb7dd3e4ac7a0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.3
|
Security for compgraph2txt 1.0.0
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.