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

Install

Python (requires Graphviz system package):

pip install hascii

Rust CLI:

cargo install hascii

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

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

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.2-cp313-cp313-win_amd64.whl (273.9 kB view details)

Uploaded CPython 3.13Windows x86-64

hascii-0.1.2-cp313-cp313-manylinux_2_39_x86_64.whl (403.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

hascii-0.1.2-cp313-cp313-macosx_11_0_arm64.whl (344.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hascii-0.1.2-cp312-cp312-win_amd64.whl (274.5 kB view details)

Uploaded CPython 3.12Windows x86-64

hascii-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl (403.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

hascii-0.1.2-cp312-cp312-macosx_11_0_arm64.whl (345.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hascii-0.1.2-cp311-cp311-win_amd64.whl (274.4 kB view details)

Uploaded CPython 3.11Windows x86-64

hascii-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl (404.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

hascii-0.1.2-cp311-cp311-macosx_11_0_arm64.whl (346.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

hascii-0.1.2-cp310-cp310-win_amd64.whl (274.3 kB view details)

Uploaded CPython 3.10Windows x86-64

hascii-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl (404.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

hascii-0.1.2-cp310-cp310-macosx_11_0_arm64.whl (346.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

hascii-0.1.2-cp39-cp39-win_amd64.whl (274.3 kB view details)

Uploaded CPython 3.9Windows x86-64

hascii-0.1.2-cp39-cp39-manylinux_2_39_x86_64.whl (404.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

hascii-0.1.2-cp39-cp39-macosx_11_0_arm64.whl (346.9 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: hascii-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 273.9 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ae49b2a49c6c4dc9c53c55319f9e29d0a501f6ac4963fdea8ffbb912cf42336c
MD5 ae2f8b58b102c1b46f7b40cf4dae0d32
BLAKE2b-256 f94b1c30a33c3a2cef4549a97a311e5dbd7dfacc4d92cab8cc4159f759d2992a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 78e8acdbd396731e793b9eed45ccbfa3e5295228ad07856bb0f2b6acba69f30f
MD5 95ef030375f15855adc87cf3bbe0333c
BLAKE2b-256 27d8fd870af4a0a27c50e7488bc2392e384e8d5d88dc16c1d6849914f7f34905

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6fdfc01aacd59898e9378c1dcf18eff24d015bf66d97822ccf6f9d9a6ad18150
MD5 1d656472e0ce28df8958c9b5221f548a
BLAKE2b-256 4571f80429485fe6c4c11e834cad878df3173b868e30f3dee3fd49db0b4ac252

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 274.5 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dbadd099c89daa7aee4d282fb5385d3391b991ac7a6fa9b54bfa59d4cfb05208
MD5 ca981c236204d9589a20923e3b02c888
BLAKE2b-256 e131a52d0ca992f429d33407e07fd5474f884ad4cd37e3839702cbf3963055ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 729d56ca7dc6bb25429cf6b391030c072fa18e3ff00191362855f2783e297bb1
MD5 197533ecb6c6a25b3c8005c9199fc413
BLAKE2b-256 9b3bdc1e3d296a6eb8be43c62e41353f1c5d9c729cdc1b8464b3c7ec3a7fb59a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aec70833b5b473b41a8b03c7fec84d1e734dd81561d766b91fa9dd819deaf4d9
MD5 359422acd10a896cde3ffe8adda16cba
BLAKE2b-256 e9d0267ee4af9b91c7d248f73d02fed1dc956daeb8439cfd9374ddd1a0c1c51e

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 274.4 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e10033428692445ccee8e03c289b0e53138789e2864fd19c649b8d5a51fc8e7b
MD5 1f0ec643e8682e2cf04bff4155ecdb7b
BLAKE2b-256 d6f62005b14a8e63fb8740206051608684bfa24bd42db10000c38b601776f5fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 d461c31326f928c27a7f2f55b16a632738f25b672aa10a8e37c28b0326c363f8
MD5 487ad1ceb538b66c02d819f835876cb9
BLAKE2b-256 c812c4e91dbd09e5e5bb429b1e5f9464ccdb0bdbf454e52c6c062243d4244cda

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9eca62fbde800264c2ccf89521f3b629789e169066a2dfdc6d9867a9cb8350e6
MD5 57ffa3a10930cbe37d3e8f0209f4e3ea
BLAKE2b-256 947207988588aebc52ee155578824c30b7f6786dc33a93ac8b8fd937c3f294ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 274.3 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 21f867d8d044ac93159e697d253d2c687a75ed9f9422e9c48c9c939644b0c095
MD5 0391ac7739e400abc8e57e0e2fbbc39b
BLAKE2b-256 0c5c3463bf8864eb2a3333fe3d096b5a9312d4f7805c69b2525f7a5189d60645

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 1d8d73fae91c7fda94b51891b56698110c51f6c8f7011e32e6ee4f8b5406945f
MD5 d31402186d7f8c64871c57e68367e518
BLAKE2b-256 08d45566d7fd37b94968d58ac453207be95625814eaddd32a71422caf45fb868

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1be17cb97aff050aa587a53d85bc1a5e424679248520643b861d8a9d6f6d99b0
MD5 1428175c2b0b32739e12652d6ca6e2e6
BLAKE2b-256 d42ed98ec9aef538f4867ce280d6b50e37ac28ef44379b0d311b5b53435fecf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: hascii-0.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 274.3 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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fadcb4c5a87df4d0b5f2cb8cb94c771a4a943f7d6bc6c1294be7b2afa6af5bdf
MD5 24225e3106df3f963149e0cedebf4c68
BLAKE2b-256 016ad5d4d1bb53e1fd92b39ccb469ec1325e5271d9207af5129ded443f9b3ba0

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp39-cp39-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 693e3b046601e5f34defbabef4e631f68101856c22df309fbc239e9c6372e627
MD5 d7e472483630c2f45fbfe596436f0355
BLAKE2b-256 de15d352ff74b6d6fe88bd1a9a8a96bb235b9d6ac664b33582f01c1cff872229

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hascii-0.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60b39e7a6a0eb231aa1bff0b219f3ba07d999c2b68868d3c3163866ab4651952
MD5 8366209a99422124ee462110d1803f57
BLAKE2b-256 2fdcd024b719f4b6c85635716ec3124e20d86c0112d317be0dfc2bdd0926cff4

See more details on using hashes here.

Provenance

The following attestation bundles were made for hascii-0.1.2-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