Skip to content

Improv: Enhance Python extractor with symbol indexing and fact extraction - #35

Merged
dejo1307 merged 1 commit into
mainfrom
feat-improve-Python
Jun 18, 2026
Merged

Improv: Enhance Python extractor with symbol indexing and fact extraction#35
dejo1307 merged 1 commit into
mainfrom
feat-improve-Python

Conversation

@GertL

@GertL GertL commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description:

This PR enhances the Python extractor to accurately resolve method calls on typed parameters and local variables across module boundaries.

Changes:
Two-pass extraction strategy:

  1. Pass 1 builds a global symbol index across all Python files, recording class definitions, inheritance relationships, and method signatures
  2. Pass 2 uses this index to resolve types when extracting call edges

Type resolution improvements:

  1. Adds type inference for function parameters with type annotations
  2. Collects local variable types from assignments and annotated assignments within function bodies
  3. Resolves variables to qualified type names via importMap and localTypes tracking

Cross-file call resolution:

  1. When a method is called on a typed object (e.g., logger.write()), the extractor now emits edges to both the abstract/interface type and all concrete implementors
  2. Prevents phantom edges for unresolvable receivers without type information

Symbol index infrastructure:

  1. pySymbolIndex: Central registry tracking all classes and their methods across the project
  2. implMap: Maps base class/interface names to their concrete implementors
  3. Proper detection of abstract classes via ABC inheritance or @AbstractMethod decorators

Tests:

  1. Added comprehensive tests for typed parameter resolution
  2. Added tests for constructor assignment type inference
  3. Added tests for abstract class implementation tracking
  4. Validates that phantom edges are not created for unresolvable types

This enables more precise dependency graph construction for Python projects using type hints and object-oriented patterns.

@GertL
GertL requested a review from dejo1307 June 18, 2026 04:40
@GertL
GertL force-pushed the feat-improve-Python branch from ebfceab to b12c6e6 Compare June 18, 2026 10:49
@dejo1307
dejo1307 merged commit 90d2c95 into main Jun 18, 2026
1 check passed
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.

2 participants