Skip to content

lensvol/astboom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Display Python AST in a console using ASCII symbols.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages