Skip to main content

Module python

Module python 

Source
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§

PythonDependencyExtractor
Python dependency extractor
PythonPackage
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
reclassify_python_import
Reclassify a Python import using the project’s package name Similar to reclassify_go_import() and reclassify_java_import()
resolve_python_import_to_path
Resolve a Python import to a file path