You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python: AST extractor misses ~53% of Python class inheritance edges (cross-file base classes) #2736
When a Python class inherits from a base class imported from another file, the AST extractor fails to emit an inherits edge. Instead it produces a weaker uses [INFERRED] edge pointing at the import line rather than the class definition.
Repro:
# module_a.py
class BaseDriver:
...
# module_b.py
from module_a import BaseDriver
class ChildDriver(BaseDriver): # <-- should produce inherits [EXTRACTED]
...
Same-file inheritance is handled correctly. The issue is that the extractor doesn't resolve imported names back to their class node when the base class comes from another module.
Measurement on a ~900-file Python codebase:
820 inheritance relationships found via ast.ClassDef.bases
389 (47%) correctly emitted as inherits edges (same-file or simple cases)
431 (53%) missing, represented only as uses [INFERRED]
Impact:
graphify path between parent and child classes routes through unrelated intermediate nodes instead of showing the direct inheritance chain
Community detection separates parent/child classes that should cluster together
Driver/plugin hierarchies with deep cross-file inheritance chains are especially affected
Environment: graphify 0.9.42, Python 3.12, Windows
I reproduced this on current v8 and traced it through final graph construction. The extracted inherits [EXTRACTED] edge is overwritten by a later uses [INFERRED] edge. Aliased imports and duplicate class names also need exact import-aware resolution.
I am preparing a focused fix with raw-extraction, built-graph, ambiguity, alias, and incremental regression coverage. I checked the overlapping #1231 and #2684 work and will keep this change compatible rather than duplicating their scope.
Activity
NithishKumar04 commentedon Aug 14, 2026
I reproduced this on current
v8and traced it through final graph construction. The extractedinherits [EXTRACTED]edge is overwritten by a lateruses [INFERRED]edge. Aliased imports and duplicate class names also need exact import-aware resolution.I am preparing a focused fix with raw-extraction, built-graph, ambiguity, alias, and incremental regression coverage. I checked the overlapping #1231 and #2684 work and will keep this change compatible rather than duplicating their scope.
fix(python): resolve cross-file inheritance by import (Graphify-Labs#…