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

Uploaded CPython 3.13Windows x86-64

hascii-0.1.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (344.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hascii-0.1.1-cp312-cp312-win_amd64.whl (274.4 kB view details)

Uploaded CPython 3.12Windows x86-64

hascii-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl (403.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

hascii-0.1.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (346.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

hascii-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl (404.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

hascii-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (346.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

hascii-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl (404.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

hascii-0.1.1-cp39-cp39-macosx_11_0_arm64.whl (347.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: hascii-0.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 273.8 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8b0fdf978cacaebcc99e60834b33b0f677bec1952b5a937479883609141b324a
MD5 0e005eb1e791028f71e7daab589ac159
BLAKE2b-256 d44d16f9a74ae4e4663d9a4230de6b127bed7d5aa80dfe4111633fdca505dd34

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 0606b1e901a01d4d627dbfb7e1c76d6e96d51f0bc06e7713bc13131ffca6300f
MD5 9de137e324ce63eca326c6d722afa962
BLAKE2b-256 8e686a19eee76b2a4dc9d6813b2ff2231a13f6744f04268459c00e1549a3f0da

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cdf363243e2e59744b5c25c5a0282e39327c356ae7c2a7aae5deb621ade11b87
MD5 f7d64b3d4e1ccc18edab0d56f68f821e
BLAKE2b-256 12e08ed87762d764bb21065e4fb8310f358218596b7ba045da96e2f787361b18

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: hascii-0.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 274.4 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 050410b24d0f617ad2a6d09be9529b00cdec87f9879ffb08acb2e290d5b27328
MD5 6d76785e2241d16a60560e66e96c7e01
BLAKE2b-256 734bf3282745da95aed4204eab07e6371a2adf9ab3d211f1cad479f2c030e3df

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 f6faadfffa24943821602ac22128df7fb280cf7e629edabd1860b1e9ea0ea5cf
MD5 96fcbbd91e53967a9f4cee21d99402bc
BLAKE2b-256 78b0f9907dd0034f7ae22918fc1cf05fab0c1d03da9ede51d08639dcfdeba4f7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 053669760ae00adeba69ddc9a02cd788c1c2d6585a2f1ec2d9dc6001329e9e94
MD5 a888f408c2947f1fc2596ead7b472554
BLAKE2b-256 a1ff47dff0dfa73fb57a0ef40f6877711dbeafc40290ddfe5b5c696274695891

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: hascii-0.1.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e380f61e1b4d9de53b06c71eede5962157975a9f879746069d423142bf0a081f
MD5 5a3c8dc77a1010624a000a6cb85efbd6
BLAKE2b-256 ff889e085baeb5cc25ba9d7b9001dfb0e5615e8b60910fb164ff839aeb2662d2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2c112c7527a489a332d540b0b8c53a829eca18ac18e64c985f44f9c6ffd93f0e
MD5 71a2c32bf425a980b85e7667bd67c593
BLAKE2b-256 20c50aba9dda8608d5b6e83d0c859690ebe7da20adcb0b0eeef35a785b38df6d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f36b32d869f54c0c6d5d1b65e2358b279aa83138c8ca7549f9796e73e1785af
MD5 bb2a5299c4da19cebb17e4cc2ad4848c
BLAKE2b-256 9582689f298aa8bab64b488ebb156429537c580a78d7f930ef0f66ae5cfd10bc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: hascii-0.1.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 40c40bbfebfe9254398a89d292cc8ad4a656f46644f66043af7ed0d358cd6060
MD5 aa5d4961150b821722445fd8c5993e97
BLAKE2b-256 4142e2ef5cc1aae22ad40038c554253fe1e0d004a7a60931cf40afb78d6fb1ae

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 21a1999a3a72f221f5ac76fe9643cbcb78d5f0d8dc1a4f242c5abd59e2829857
MD5 d494265231414a7c13b562785d877988
BLAKE2b-256 1d178ce05db8e9124f20540ddcad0a19dd7d30da267b3e9a8ad8a82484604f88

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8231cc34fc11794549f16d814f3138d3f1c2d5c2e85b8c0ac39a2cf22fac321a
MD5 850612316c1bf7e7fe082a4ef5b461fc
BLAKE2b-256 5c485eb4d772249ec9a2c0a125e928f40a29b1c7a0c590f45aacb80cd68048ab

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: hascii-0.1.1-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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 59bd45397f934957df52ab782ea1538eac625e9982b2fd1428a38e1126bf9e17
MD5 e20629cde6d7270acfeae3cdac65b176
BLAKE2b-256 bca236b8839cd1ada82aa281c2c7f14422ff866ddb6ba536465edd648e09fe25

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 769fdcf33ab976e607573aaa7d654965e8a762f5e0690d486a2414435a009cd2
MD5 46ba248e24a60fc7472c8f31cef8a755
BLAKE2b-256 18517faa8ca26ba987669e00747b1d3d81538ee200af42c7406b19fae013f3a1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hascii-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43c7b36ce7e137653e4f8d8fdd578da8ebd4c1c13acff609156b8c5d4f5c1eb1
MD5 9a2e51d50ef38359b5925e732606921c
BLAKE2b-256 5ea2ba5cc05550399255cfb5dc9bb9643d18b70d4711aa6b8eb7e9613547b8e6

See more details on using hashes here.

Provenance

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