Skip to main content

3viz, a terminal AST visualizer for document trees

3viz is designed to simplify reasoning about document trees. The one-line-per-node and columnar layout makes scanning and understanding structure easy, while the textual representations, icons and metadata provide additional information at a glance.

Being line-based, it makes diffing trees useful and can be invaluable in debugging parse trees.

This is a sample output:

⧉ Document                                                                                                                                         7L
  ¶ This is a paragraph:                                                                                                                         2L
    ↵ This is a paragraph:                                                                                                                       1L
    ↵ With two lines.                                                                                                                               1L
    ↵ This document is the nanos spec, showing all elements, but not covering their full variation   1L
  № List                                                                                                                            type=ordered 2L
    §"Session And titles                                                                                                                           2L
      ⊤"Session And titles                                                                                                                        1L
      ⊡ Content                                                                                                                                         1L
        № List                                                                                                                     type=ordered  1L
          •     2. Core Elements                                                                                                                  2L
            ◦     2. Core Elements                                                                                                               1L
            ⊡ Content                                                                                                                                  1L
              ¶         Which should have at least one item.                                                                          1L
                ↵ Which should have at least one item.                                                                                1L
  𝒱 4. A simple code block: (-)                                                                                              13L

Installing

3viz is available on PyPI as treeviz-py, and can be installed with your preferred Python package manager:

$ pipx install treeviz-py  # recommended for global availability

Using 3viz

3viz can be used as a CLI:

$ 3viz <tree_path> <tree_format>

Or as a library:

from treeviz import generate_viz

# Both document and format can be a path to a file, strings, or Python objects
generate_viz(document, format)

Built-in adapters

  • mdast: Markdown Abstract Syntax Tree format used by remark and other Markdown processors
  • unist: Universal Syntax Tree format, the base format for unified ecosystem parsers
  • pandoc: Pandoc's JSON AST format for converting between markup formats
  • restructuredtext: reStructuredText document trees from the docutils library

Learn more

Metadata

Release files for treeviz-py 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for treeviz-py 0.4.0
File Size Uploaded Provenance Actions
treeviz_py-0.4.0.tar.gz 51.1 kB Without provenance Details for treeviz_py-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for treeviz-py 0.4.0
File Interpreter ABI Platform Actions
treeviz_py-0.4.0-py3-none-any.whl Python 3 none any Details for treeviz_py-0.4.0-py3-none-any.whl

Total release size: 119.9 kB

Release files / treeviz_py-0.4.0.tar.gz

Download URL treeviz_py-0.4.0.tar.gz
Size 51.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5231112b45425a584bc32b166bcf8e786af7b7271bb4a3a2b351b62cab9c1ee9
BLAKE2b-256 checksum
How to use checksums
a7819badb2f704f5f21a209fceaf76d839a4f73973c5023fef32f808a0fff2d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / treeviz_py-0.4.0-py3-none-any.whl

Download URL treeviz_py-0.4.0-py3-none-any.whl
Size 68.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
761517fbb9e3aaab88527f2a308652a509f077cf928651d45464899c3f3a07d2
BLAKE2b-256 checksum
How to use checksums
855755f7c77b2d919bc3b697a397b6739c6333388758a7afc4dd1bf040bef990
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for treeviz-py 0.4.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page