Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lensvol/astboom
Display Python AST in a console using ASCII symbols.
https://github.com/lensvol/astboom
Last synced: about 2 months ago
JSON representation
Display Python AST in a console using ASCII symbols.
- Host: GitHub
- URL: https://github.com/lensvol/astboom
- Owner: lensvol
- License: mit
- Created: 2019-10-16T20:19:03.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-23T16:59:51.000Z (almost 5 years ago)
- Last Synced: 2024-09-13T03:09:01.762Z (4 months ago)
- Language: Python
- Size: 129 KB
- Stars: 9
- Watchers: 3
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# astboom
![PyPI](https://img.shields.io/pypi/v/astboom)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/astboom)
![GitHub](https://img.shields.io/github/license/lensvol/astboom)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)Visualize Python AST/CST/ST in console using ASCII graphics using various engines.
Engines available:
* **[ast](https://docs.python.org/3/library/ast.html)** module
* **[parser](https://docs.python.org/3/library/parser.html)** module
* **lib2to3**
* **[LibCST](https://github.com/Instagram/LibCST)**## Example
![Example usage](https://raw.githubusercontent.com/lensvol/astboom/master/docs/example.png)
## 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
```shell script
# pip install astboom
```## Getting started with development
```shell script
# git clone https://github.com/lensvol/astboom
# poetry install
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
## Authors
* **Kirill Borisov** ([[email protected]](mailto:[email protected]))