@reponova/lang-python
v0.4.0
Published
Python language support for RepoNova
Downloads
547
Maintainers
Readme
@reponova/lang-python
Python language support for RepoNova. Parses .py / .pyw source files via the official tree-sitter-python WASM grammar.
Install
reponova lang add @reponova/lang-pythonWhat it extracts
- Symbols:
- Functions and async functions (the latter carry an
asyncdecorator marker). - Classes and methods, including those declared inside
if TYPE_CHECKING:/try / exceptblocks. - Top-level
UPPER_SNAKE_CASEconstants. TypeVar/NewType/ParamSpec/TypeVarTupledeclarations astypesymbols.- PascalCase type aliases (
User = Dict[str, Any],Maybe = int | None) and PEP 695type Foo = …aliases.
- Functions and async functions (the latter carry an
- Decorators:
@decorator/@module.decoratoron functions, methods, and classes. - Docstrings: module-level (first triple-quoted expression), per-function and per-class.
- Imports:
import x,from x import y,from . import y,from .. import y, aliased imports (import x as y), wildcard imports (from x import *),from __future__ import …directives. Imports nested insideif TYPE_CHECKING:andtry / except ImportError:blocks are surfaced at the module level.__init__.pyimports are flagged as exports. - Heritage: plain (
Foo(Bar)), subscripted generics (Foo(Bar[K, V])→Bar), dotted (Foo(pkg.mod.Bar)).metaclass=Metakeyword arguments are ignored. - Calls: every call expression in a function/method body, by name.
- Exports:
__all__literal list when present; otherwise every public top-level symbol (no leading_).
Extensions
.py, .pyw
Configuration
In reponova.yml:
plugins:
python:
enabled: true # default: true
# patterns: [] # override global patterns for Python files
# exclude: [] # override global exclude for Python files| Property | Type | Default | Description |
|----------|------|---------|-------------|
| enabled | boolean | true | Enable/disable Python file detection and extraction |
| patterns | string[] | [] | Glob patterns to override global file matching for this plugin |
| exclude | string[] | [] | Glob patterns to override global exclusions for this plugin |
Resolution semantics
from .module import xresolves relative to the importer file.from ..pkg import ywalks two directories up.- Bare absolute imports (
from foo.bar import baz) return bothfoo/bar.pyandfoo/bar/__init__.pyas candidates; existence is checked by the host application. - Each captured class base also emits an
extendsreference. Calls producecallsreferences on the enclosing function/method.
License
MIT — see LICENSE.
