Skip to main content

Visualize Python AST in console.

Project description

astboom

PyPI PyPI - Python Version GitHub Code style: black

Visualize Python AST/CST/ST in console using ASCII graphics using various engines.

Engines available:

Example

Example usage

Usage

Simply provide a valid Python source code string as an argument and a corresponding AST/CST/ST will be displayed.

AST

Usage: astboom ast [OPTIONS] [SOURCE]

  Display Abstract Syntax Tree for a given source.

Options:
  --no-pos      Hide 'col_offset' and 'lineno' fields.
  --hide-empty  Hide empty fields.

lib2to3 CST

Usage: astboom cst [OPTIONS] [SOURCE]

  Display Concrete Source Tree for a given source.

Options:
  --show-prefix  Display value stored in 'prefix' field of the node.

Python parse tree

Usage: astboom st [OPTIONS] [SOURCE]

  Display Python parse tree for a given source.

LibCST tree

Usage: astboom libcst [OPTIONS] [SOURCE]

  Display LibCST tree for a given source.

Options:
  --hide-default   Hide fields that contain default value
                   (MaybeSentinel.DEFAULT).
  --hide-empty     Hide fields that contain empty values ([], (), '').
  --hide-fmt       Hide formatting-related fields and objects (whitespace,
                   newlines).
  --show-children  Show contents of the 'children' attribute.

If no source provided as an argument, then tool will attempt to read it from STDIN.

Installation

# pip install astboom

Getting started with development

# git clone https://github.com/lensvol/astboom
# poetry install

License

This project is licensed under the MIT License - see the LICENSE file for details

Authors

Project details


Download files

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

Source Distribution

astboom-0.4.2.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

astboom-0.4.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file astboom-0.4.2.tar.gz.

File metadata

  • Download URL: astboom-0.4.2.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.7.2 Darwin/18.7.0

File hashes

Hashes for astboom-0.4.2.tar.gz
Algorithm Hash digest
SHA256 bd6672701cef98c1bca63c132c46facb89c6171326c3e72b0319e6c74f8070ad
MD5 549a89caa7df5440acdff8494a6170b3
BLAKE2b-256 7273a755c63794bc5de018337cbc34dcc6d3b5ee1c3b279fb7e0dce888653d17

See more details on using hashes here.

File details

Details for the file astboom-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: astboom-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.7.2 Darwin/18.7.0

File hashes

Hashes for astboom-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e0b23173a830f3a4c4971076c936715ada2e9d63062cf9b95917930e5a93f860
MD5 e0842618adc93fed3a5cec1eb05af01f
BLAKE2b-256 fb21110acf07d88dee640009879ae57f11153ff2fc84c96dd5d8854458084bb9

See more details on using hashes here.

Supported by

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