Skip to main content

Convert Graphviz DOT files to ASCII box-drawing art

Project description

hascii

hascii

Convert Graphviz DOT graphs to Unicode box-drawing art

CI crates.io PyPI License

Embed readable flow diagrams in docstrings, source code, and plain-text docs.
No image viewer needed — just Unicode text.


What it does

Takes a Graphviz DOT graph and renders it as ASCII art with box-drawing characters:

  ┌───────┐
  │ Start │◀─┐
  └───────┘  │
      │      │retry
      │      │
      ▼      │
  ┌───────┐  │
  │ Check │──┘
  └───────┘
      │ok
      │
      ▼
  ┌──────┐
  │ Done │
  └──────┘

Back-edges, conditions, and edge labels

    ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
 ┌─▶┆ router_while_simple_flow_while_i_lt_max_iterations ┆
 │  └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
 │                             │p['i'] < p['max_iterations']
 │                             └─────────────────────────────────┐
 │                             │                                 │else
 │                             ▼                                 ▼
 │          ┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐     ┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐
 │          ┆ router_while_simple_flow_seq_set_i ┆     ╎ handler_finalize ╎
 │          ┆            p['i'] += 1             ┆     └╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘
 │          └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
 │           ┌─────────────────┘
 │           ▼
 │  ┏┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┓
 └──┇ handler_process ┇
    ┗┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┛
Full graph and source files

flow.txt | flow.dot | flow.png

Subgraph grouping

Cluster subgraphs render as dashed group boxes:

       ┌────────────┐
       │ preprocess │
       └────────────┘
              │
   ┌ validation_stage ╌╌╌┐
   ╎          ▼          ╎
   ╎    ┌──────────┐     ╎
   ╎    │ validate │     ╎
   ╎    └──────────┘     ╎
   ╎          │          ╎
   ╎          ▼          ╎
   ╎     ┌────────┐      ╎
   ╎     │ enrich │      ╎
   ╎     └────────┘      ╎
   └╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘
              │
              ▼
          ┌───────┐
          │ store │
          └───────┘

Color modes

Node fill colors are conveyed through border styles (B/W) or ANSI colors (terminal):

Mode Borders When
ANSI colors ┌──┐ + colored Terminal (default), Python color=True
Hue borders ┌┄┄┐ ┏┅┅┓ ┌╌╌┐ CLI --no-color, piped output
Plain ┌──┐ uniform Python color=False
Hue border reference
Border Color family Example fills
┌──┐ solid Green palegreen
┌┄┄┐ light triple-dash Orange/Yellow wheat, gold
┌╌╌┐ light double-dash Red lightsalmon
┏┅┅┓ heavy triple-dash Blue lightblue
┏╍╍┓ heavy double-dash Purple/Pink plum
┏━━┓ heavy solid Dark black

Quick start

Try without installing (requires uv and Graphviz):

echo 'digraph { A -> B -> C }' | uvx hascii -
uvx hascii flow.dot
uvx hascii - < flow.dot

Install

Graphviz is a required system dependency (hascii uses dot for layout):

sudo apt-get install graphviz   # Debian/Ubuntu
brew install graphviz            # macOS

Python:

pip install hascii

Rust CLI:

cargo install hascii

Python API

import hascii

dot = '''
digraph {
    A [label="Start"]; B [label="End"];
    A -> B;
}
'''

# ANSI colors (default) — for terminal display
print(hascii.render(dot))

# Plain solid borders — for docstrings and source code
print(hascii.render(dot, color=False))

# All options
hascii.render(
    dot_source,
    max_width=72,       # constrain output width
    trim="smart",       # label trimming: end, start, middle, smart
    max_label=30,       # max label length
    color=False,        # True: ANSI colors, False: plain borders
)

# From file
hascii.render_file("flow.dot", color=False)

CLI

hascii [OPTIONS] <FILE>

Arguments:
  <FILE>  Path to a .dot file, or "-" to read from stdin

Options:
      --width <N>          Max output width in characters
      --trim <STRAT>       Label trimming strategy [default: smart]
      --max-label <N>      Max label width in characters
      --no-color           Use hue-based border styles instead of ANSI colors
  -v, --verbose...         Increase verbosity
  -h, --help               Print help
# Render a DOT file (colors on terminal)
hascii flow.dot

# Pipe from stdin
echo 'digraph { A -> B }' | hascii -

# Save to file (hue-based borders, no ANSI)
hascii --no-color flow.dot > flow.txt

# Constrain for docstrings
hascii --width 72 --max-label 25 flow.dot

Rust API

use hascii::{render, RenderOptions};

let dot = r#"digraph { A -> B -> C }"#;
let options = RenderOptions::default();
let ascii = render(dot, &options).expect("render failed");
println!("{ascii}");

Label trimming

Long labels are trimmed with --trim / trim=:

Strategy Result (budget 25)
smart (default) router_text...threshold
end router_text_impro...
start ...score_ge_threshold
middle router_te...threshold

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hascii-0.1.3-cp313-cp313-win_amd64.whl (286.5 kB view details)

Uploaded CPython 3.13Windows x86-64

hascii-0.1.3-cp313-cp313-manylinux_2_39_x86_64.whl (420.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

hascii-0.1.3-cp313-cp313-macosx_11_0_arm64.whl (358.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hascii-0.1.3-cp312-cp312-win_amd64.whl (287.1 kB view details)

Uploaded CPython 3.12Windows x86-64

hascii-0.1.3-cp312-cp312-manylinux_2_39_x86_64.whl (421.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

hascii-0.1.3-cp312-cp312-macosx_11_0_arm64.whl (358.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hascii-0.1.3-cp311-cp311-win_amd64.whl (287.1 kB view details)

Uploaded CPython 3.11Windows x86-64

hascii-0.1.3-cp311-cp311-manylinux_2_39_x86_64.whl (420.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

hascii-0.1.3-cp311-cp311-macosx_11_0_arm64.whl (362.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

hascii-0.1.3-cp310-cp310-win_amd64.whl (287.0 kB view details)

Uploaded CPython 3.10Windows x86-64

hascii-0.1.3-cp310-cp310-manylinux_2_39_x86_64.whl (420.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

hascii-0.1.3-cp310-cp310-macosx_11_0_arm64.whl (362.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

hascii-0.1.3-cp39-cp39-win_amd64.whl (287.0 kB view details)

Uploaded CPython 3.9Windows x86-64

hascii-0.1.3-cp39-cp39-manylinux_2_39_x86_64.whl (421.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

hascii-0.1.3-cp39-cp39-macosx_11_0_arm64.whl (362.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file hascii-0.1.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 286.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hascii-0.1.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fbf1c900e54c5339e85748cf1a35e81d2fc20cb3b8e603d3ae7aedbcdc993f47
MD5 0acf9d652e0a5d2169ccf2a0477cee78
BLAKE2b-256 0b746c7467ee45915a0d53505b47e142cb78fe8036f93bd7a6f08355199cdaee

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp313-cp313-win_amd64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 edb83fb1e066d3064f695fbabb81c383f38ba23f8e908f06c8f672ff0db81d5d
MD5 e2c2d7d426cc3f2bedac458afb9e7a76
BLAKE2b-256 b8df81d2ae6f98489ad589e63de4491512537509b8bc2c996ebb2cc2ccf629aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp313-cp313-manylinux_2_39_x86_64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e511e5fd985af195aaac167c5a86bca88aa8d5004031f9f6c00a2b2d8697a2a0
MD5 3e81b087bdc487a13650d533f14e7d12
BLAKE2b-256 daecab1cabb7a8ad67933acd68e7f4d3af67897ff3cc021e54b6b4f1399da305

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 287.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hascii-0.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c2197fe311528554430a7838bbddc4e5e75edca4e81664b4a03ef10806c15db8
MD5 0a70201f0556a180d787aa2ce8efc789
BLAKE2b-256 94575c91731dc1b57d8042a0d82615e7aa941198f937506fbe86ed0c8eadbffd

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp312-cp312-win_amd64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 03ec453dd98214a2488fe941cc0ed6056eeb1ecc1d0f6ecf5a083389353c5baa
MD5 9568a3388ecd24e4a013db335710a28b
BLAKE2b-256 d5021c8e23bf99b967a653a8b5da06dc5ba33b0cc298a486f475ee300901fe40

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 de888a21972781ff86569eca0bd3a3d8b428d47647664fd20fbf248b027910b5
MD5 4870358d2edb69cbcacf59333bba61ac
BLAKE2b-256 07dca2d93e73536218e1bb7abbf5d2c7c6e7bb8607afb23f2e0bc79655f0d6ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 287.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hascii-0.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0bdcbe6453f4555f7fe5b7581d1d456a039b6238f50f5c6726bad1328931a369
MD5 ccd61d8aa62a8c2db45ac21a6c242d93
BLAKE2b-256 7976d5b7879ce72df8ed0f4858f49a269535a4135f8083784fda9649eeb91f1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp311-cp311-win_amd64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c66937b9cc63f29ee0dd04b10fd617490ef0856fedbac971b6c96e517165cd41
MD5 3f6d4d97ca49e1c37b184cdbb0ab34e1
BLAKE2b-256 cccd896ae2354dba934c29efe8161402d7fb0afbf316aa5048815d18c8ac23ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp311-cp311-manylinux_2_39_x86_64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8deceeb0b5b32cee97ea82b64aa1bebdd40b252bf5d68713d074248fd5b3de6a
MD5 a6a5ca8c63548eb50ac7be176a386522
BLAKE2b-256 fc732146a07582b60bba9d93170ce1040edc034fd41f5b17044210f1d62a23ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 287.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hascii-0.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 60d5423ee15b5ba3e6e16223c675872fceaa8964199428bfae151ed6481bcbf6
MD5 13953a4e5034ca83a1ad966d09df3fbd
BLAKE2b-256 d3c93f071a632d5b9db8439f9c901e36e6dcf9bf0090e21e3e8cfa08d0e4c13b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp310-cp310-win_amd64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 4bfa7c73825c2eb7178002d28b50d1f4a1365cc95dca8870a8e91f87a6f641d1
MD5 d97aeb18b7e2dbd5d473e101b1876989
BLAKE2b-256 a554cdd8897f4d29dd082ae58600e0cfde21ef6aaedf90fc223dcd534288893c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp310-cp310-manylinux_2_39_x86_64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d05e8a2e27cadbb5ad944ab4b34d03d6425a28483e3d01d5b03c52ae63fc33e
MD5 6b94ec9a9570a939b1d1816ef95dda32
BLAKE2b-256 0d22088a4de531fed98d52f4bb5cfad33ccf9415a2d2ecd54d996971e4f73b04

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 287.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hascii-0.1.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 96780a456ca874f30ee42529495994564acd173c0cce11a13eb145cb4f63e32e
MD5 247439026556c210bd5c85ea1ef09b1d
BLAKE2b-256 dde9057a141ce9053cff00dc0f03f92a7d77f7be813222e5d92ade9332c61edb

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp39-cp39-win_amd64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp39-cp39-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 8fd7d4efa56c9088c61c1492a695b0bdf234af074ddd2b99770060d0dd99ce94
MD5 fec50d973f8972eb17e53df68ebb134c
BLAKE2b-256 251880f6ea386238f4d6cf217550f68092dc8e7bbad046fd77772af02fb162d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp39-cp39-manylinux_2_39_x86_64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hascii-0.1.3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb268296b192642130a3d1f3895c933972f90fa1cff4f475ef5d024a913191cb
MD5 9593c79926f98b42940d00d2f7970a42
BLAKE2b-256 25f41b61394fd0a67706ed2a78ef7538039348bdcfe0ba8be7c0027118e806ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.3-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on atemate/hascii

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page