Skip to content

feat(graph): add Python code graph extractor#103

Open
abhinav-phi wants to merge 1 commit into
mex-memory:code-graph-previewfrom
abhinav-phi:feat/python-code-graph-extractor
Open

feat(graph): add Python code graph extractor#103
abhinav-phi wants to merge 1 commit into
mex-memory:code-graph-previewfrom
abhinav-phi:feat/python-code-graph-extractor

Conversation

@abhinav-phi

Copy link
Copy Markdown

What

  • Add a Python LanguageExtractor for the code graph.
  • Register Python extraction and .py file detection.
  • Vendor and register the Tree-sitter Python WASM grammar.
  • Add representative Python fixtures and focused extractor tests.
  • Emit file, class, function, method, module variable, constant, import, call, inheritance, instantiation, and containment graph information while preserving unresolved cross-file references via targetName.

Why

Closes #94.

This adds first-class Python language support to the code-graph preview branch while preserving the frozen LanguageExtractor interface and existing graph semantics.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Docs
  • CI/Tooling

How to test

  1. Run:
    npm run typecheck
  2. Run:
    npm test
  3. Run:
    npm run build
  4. Verify:
    • Python files (.py) are detected correctly.
    • Python extractor emits file, class, function, method, import, call, inheritance, instantiation, and containment nodes/edges.
    • Cross-file references remain unresolved through targetName.
    • The Python grammar WASM is bundled into the build output.

Checklist

  • Tests pass (npm test)
  • No breaking changes (or documented below)
  • Tested locally with a real project

Code-graph preview

  • This PR targets code-graph-preview, not main
  • The linked issue states Target branch: code-graph-preview
  • The change follows the frozen LanguageExtractor or FrameworkResolver interface
  • A focused fixture and assertions for the expected node/edge shape are included
  • Any new grammar WASM, extension mapping, extractor, or resolver is registered
  • No graph identity, reconciliation, schema, or drift-semantics changes are included, or a core / discuss-first issue is linked above

@abhinav-phi abhinav-phi changed the base branch from main to code-graph-preview July 15, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python] Add code-graph extractor

1 participant