Expand description
Python language parser using Tree-sitter
Extracts symbols from Python source code:
- Functions (def, async def)
- Classes (regular, abstract)
- Methods (regular, async, static, class methods, properties via @property)
- Decorators (tracked in scope)
- Lambda expressions assigned to variables
- Local variables (inside functions)
- Global variables (module-level non-uppercase variables)
- Constants (module-level uppercase variables)
- Imports/Exports
Structs§
- Python
Dependency Extractor - Python dependency extractor
- Python
Package - Represents a Python package configuration with its location
Functions§
- find_
all_ python_ configs - Recursively find all Python configuration files (pyproject.toml, setup.py, setup.cfg) in the repository, respecting .gitignore
- find_
python_ package_ name - Find the Python package name from pyproject.toml, setup.py, or setup.cfg This is used to determine which imports are internal vs external
- parse
- Parse Python source code and extract symbols
- parse_
all_ python_ packages - Parse all Python packages in a monorepo and track their project roots
- parse_
python_ packages_ from parse_all_python_packagesfor config files already found (in walk order).- python_
import_ candidates - The paths a Python import can name, most specific first:
a/b.py, thena/b/__init__.py(a package). Absolute imports need a package of the workspace whose name is the first component; relative ones (..x) are taken fromcurrent_file_path. No candidate starts with/: a package at the index root has an empty project root. - reclassify_
python_ import - Reclassify a Python import using the project’s package name Similar to reclassify_go_import() and reclassify_java_import()