TUI tool for exploring Python Abstract Syntax Trees (AST) with interactive tree view and source highlighting
textual-astview is a terminal-based tool for exploring Python Abstract Syntax Trees (AST), built using the Textual framework. The tool provides an interactive tree view that displays the AST structure of Python source files alongside the corresponding source code with syntax highlighting.
The tool consists of both a command-line application called astare and a library of Textual widgets. The main widgets include ASTView for displaying the AST tree structure, Source for showing syntax-highlighted source code, and NodeInfo for displaying summary information about the currently focused AST node. These widgets work together to provide synchronized navigation between the AST tree and source code.
The application supports features like dark/light mode toggling, resizable panes, file loading without restarting, and configurable source code styling using Pygments themes. Users can navigate through the AST structure and see corresponding source code sections highlighted, making it useful for developers learning about Python's internal representation or debugging code analysis tools.
Note that the author has marked this repository as unlikely to receive future updates, recommending the newer DHV application instead. The tool requires Python and can be installed via pip, making it accessible to Python developers interested in understanding AST structures or building code analysis tools.
# via pip
pip install textual_astview
