branchy
Live, hierarchical console process trees for Python, with zero dependencies.
Visual sample
A successful run collapses to a calm, depth-styled tree:
✓ Deploy
✓ Validate
✓ Build
✓ Compile
✓ Link
A failed run keeps the transient logs visible:
✗ Publish
starting upload
✗ Sign package
private key not found
Installation
pip install branchy
Quick start
from branchy import process
import time
with process("Build") as build:
with build.child("Compile") as c:
c.log("gcc main.c")
time.sleep(0.5)
with build.child("Link") as l:
l.log("ld -o app")
time.sleep(0.3)
API usage
process(label) starts a root context. Inside the body:
p.log(message)appends transient output under the current node.p.child(label)creates a nested process.- Clean exit marks the node done and clears its transient logs.
- Exception exit marks the node failed, keeps the logs, appends the exception message, and re-raises the exception.
Both process and child are context managers.
Output lifecycle
Logs are temporary detail. They disappear once a branch succeeds, but remain visible on failure so the reason can be seen.
During a running branch:
⠋ Build
compiling…
⠙ Compile
gcc main.c
After success:
✓ Build
✓ Compile
After failure:
✗ Build
compiling…
✗ Compile
gcc main.c
error: implicit declaration
Environment / behavior
| Variable / condition | Effect |
|---|---|
NO_COLOR set |
No color styling; cursor movement still works in a TTY. |
TERM=dumb |
Plain ASCII output, no ANSI cursor control. |
| stdout not a TTY | Static output; no animation; transient logs are not erased. |
COLUMNS |
Fallback terminal width when it cannot be queried from the OS. |
Examples
Nested success tree
from branchy import process
import time
with process("Deploy") as deploy:
with deploy.child("Validate") as v:
v.log("schema ok")
time.sleep(0.2)
with deploy.child("Build") as b:
with b.child("Compile") as c:
c.log("gcc -O2 main.c")
time.sleep(0.3)
with b.child("Link") as l:
l.log("ld -o app")
time.sleep(0.3)
Failure handling
from branchy import process
try:
with process("Publish") as p:
p.log("starting upload")
with p.child("Sign package") as s:
s.log("private key not found")
raise RuntimeError("signing failed")
except RuntimeError as exc:
print(f"Expected failure captured: {exc}")
Limitations
- Designed for small trees; rendering is
O(number of live rows)per frame. - Wide-character widths are best-effort via Unicode East Asian Width and combining-mark handling.
- The library intentionally does not persist logs, show progress percentages, or provide pluggable themes.
Metadata
Release files for branchy 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 |
|---|---|---|---|---|
| branchy-1.0.0.tar.gz | 7.8 kB | Without provenance | Details for branchy-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| branchy-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for branchy-1.0.0-py3-none-any.whl |
Total release size: 15.9 kB
Release files / branchy-1.0.0.tar.gz
| Download URL | branchy-1.0.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99b3e978437fee2e9c00bf9122691b808cc116634f4b9d9611aae6942fec981c
|
|
BLAKE2b-256 checksum How to use checksums |
8e66787e5b16b8cf5e20939b3d81d8edb4b4fcdb02cdc7cd981f90cb6244a65b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.9
|
Release files / branchy-1.0.0-py3-none-any.whl
| Download URL | branchy-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88869e06e6a9c3e81034732a2769134a42133831a72f41669791402508562853
|
|
BLAKE2b-256 checksum How to use checksums |
b731937306299690e53d7cf304e06fa36d91c222429728c0b84a585a0e1c40b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.9
|
Security for branchy 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.