Summary
Python code using importlib.import_module('module.name'), __import__('package'), or importlib.util.find_spec() never creates import symbols or references. These dynamic import patterns are idiomatic in plugin systems, configuration-driven module loading, and lazy imports. Currently only static import and from ... import statements are recognized; all programmatic import sites are invisible to the call graph and symbol dependency map.
Where
src/CodeIndex/Indexer/Symbols/SymbolExtractor.Python.cs:56-126 — TryExpandPythonImportSymbols only processes static import statements (regex on lines 12-13)
src/CodeIndex/Indexer/References/Languages/PythonReferenceExtractor.cs:118-150 — EmitDecoratorReferences does not cover dynamic module resolution patterns
Suggested approach
- Add regex patterns for
importlib.import_module(...), __import__(...), and importlib.util.find_spec(...)
- Extract the module name argument as an import symbol (with dynamic fallback kind if string is not a literal)
- Register calls to importlib functions as references to the
importlib module
Summary
Python code using
importlib.import_module('module.name'),__import__('package'), orimportlib.util.find_spec()never creates import symbols or references. These dynamic import patterns are idiomatic in plugin systems, configuration-driven module loading, and lazy imports. Currently only staticimportandfrom ... importstatements are recognized; all programmatic import sites are invisible to the call graph and symbol dependency map.Where
src/CodeIndex/Indexer/Symbols/SymbolExtractor.Python.cs:56-126— TryExpandPythonImportSymbols only processes static import statements (regex on lines 12-13)src/CodeIndex/Indexer/References/Languages/PythonReferenceExtractor.cs:118-150— EmitDecoratorReferences does not cover dynamic module resolution patternsSuggested approach
importlib.import_module(...),__import__(...), andimportlib.util.find_spec(...)importlibmodule