Skip to content

Fix Python dynamic import indexing - #2632

Merged
Widthdom merged 3 commits into
mainfrom
codex/fix-issue2056
May 24, 2026
Merged

Fix Python dynamic import indexing#2632
Widthdom merged 3 commits into
mainfrom
codex/fix-issue2056

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • Index literal Python dynamic imports from importlib.import_module, importlib.util.find_spec, and __import__.
  • Emit reference entries for literal dynamic imports while avoiding comments, string literals, and variable module names.
  • Add regression coverage for symbol extraction and reference extraction.

Validation

  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -c Release -p:UseSharedCompilation=false --filter "FullyQualifiedName~SymbolExtractorTests.Extract_Python_IndexesDynamicImportLiteralModules|FullyQualifiedName~ReferenceExtractorTests.Extract_PythonDynamicImports_EmitImportAndImportlibReferences"
  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -c Release -p:UseSharedCompilation=false --filter "FullyQualifiedName~SymbolExtractorTests.Extract_Python|FullyQualifiedName~ReferenceExtractorTests.Extract_Python"
  • dotnet run --project tools/CodeIndex.Changelog -- check
  • dotnet build CodeIndex.sln -c Release -p:UseSharedCompilation=false
  • dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll index . --commits ce49d3efe1ae42cef0e0ff92e3cbc64a1677f167 --json
  • dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll status --check --json
  • Adversarial review: No blocking/actionable issues found.

Documentation / Changelog

  • Added changelog fragment: changelog.d/unreleased/2056.fixed.md

Follow-up Candidates

  • None.

Fixes #2056

@Widthdom
Widthdom merged commit 69aa83b into main May 24, 2026
10 checks passed
@Widthdom
Widthdom deleted the codex/fix-issue2056 branch May 24, 2026 12:58
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 dynamic imports via importlib and __import__() not indexed as symbol references

1 participant