feat(core): Python language support#23
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add 'python' to TreeSitterLanguage and SUPPORTED_LANGUAGES. Define PYTHON_QUERIES with 8 S-expression patterns for functions, classes, methods, decorators, imports, and module variables. All queries validated against tree-sitter-python grammar. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PythonScanner extracts functions, classes, methods, imports, decorators, type hints, docstrings, __all__ exports, callees, snippets, and async. - Refactor isTestFile() to language-aware pattern map - Refactor findTestFile() for Python test path conventions - Skip generated files (_pb2.py, migrations/, # Generated by) - Register in scanner registry alongside TypeScript, Go, Markdown Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9 Python-specific S-expression queries for error handling (try/except, raise, except), imports (import, from-import, relative), and type coverage (typed params, return types, function count). - Add 'python' to WasmPatternMatcher supported languages + extension map - Refactor runAllAstQueries to QUERIES_BY_LANGUAGE map (no if/else chain) - Update tests: .py is now supported, use .rs for unsupported language Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 tests covering FastAPI fixture (async, decorators, type hints, docstrings, imports, callees, exports), utils fixture (__all__, private/public, module constants), document parity with Go/TS, and isTestFile Python patterns. Fixtures: fastapi-app.py, python-utils.py Changeset: v0.11.0 (minor — new language support) Docs: README, website release notes, latest-version Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add test verifying decorated functions not extracted twice - Clean up dead ternary in callee extraction - Remove unused _allExports param from extractMethods - Add comment explaining basename usage in Python isTestFile - Add generated file skip test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…edge cases New python-service.py fixture tests: - __init__, @Property, @classmethod, @staticmethod extraction - Multi-line Google-style docstrings (Args, Returns, Raises preserved) - Async methods inside classes - Private method export detection 33 Python scanner tests total (was 24). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dev-agent now indexes Python codebases. All MCP tools work with Python automatically.
What it does
PythonScanner extracts from
.pyfiles:@app.route,@pytest.fixture,@property)def foo(x: int) -> str)__all__for export control,_prefix convention as fallbackimport,from...import, relative imports)Pattern rules for
dev_patternson Python files:Infrastructure improvements:
isTestFile()refactored to language-aware pattern mapQUERIES_BY_LANGUAGEmap replaces if/else chain_pb2.py, migrations,# Generated by)Changes
packages/core/src/scanner/python.tspackages/core/src/scanner/python-queries.tspackages/core/src/scanner/index.tspackages/core/src/utils/test-utils.tspackages/core/src/pattern-matcher/rules.tspackages/core/src/pattern-matcher/wasm-matcher.tspackages/core/src/services/pattern-analysis-service.tspackages/core/src/scanner/tree-sitter.tspackages/dev-agent/scripts/copy-wasm.jsTest plan
Supported languages
Generated with Claude Code