TUI tool for exploring Python Abstract Syntax Trees (AST) with interactive tree view and source code highlighting
textual-astview is a terminal user interface application for exploring Python Abstract Syntax Trees (AST). Built with Textual, it provides an interactive tree view that displays the AST structure of Python source files alongside the corresponding source code with syntax highlighting.
The tool includes three main widgets: ASTView for displaying the AST tree structure, Source for showing syntax-highlighted Python code, and NodeInfo for displaying details about the currently focused AST node. These widgets work together to provide a comprehensive view of how Python code is parsed and structured internally.
The package installs a command called astare that can load and explore any Python source file. It supports features like dark/light mode switching, resizable panes, file reloading without restarting the application, and configurable source code styling using Pygments themes. This tool is particularly useful for Python developers who want to understand AST structure, language researchers, or anyone working on Python parsing and code analysis tools.
# via pip
pip install textual_astview
