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
bug(indexer): add_package_to_graph on a flat module (six, typing_extensions) resolves to the entire site-packages directory and indexes the whole environment #1528
for any non-stdlib module whose spec.origin is a bare .py file rather than an __init__.py. For a flat, single-module package — six.py, typing_extensions.py — the parent directory issite-packages.
add_package_to_graph(package_name="six", language="python") sets discovered_path to the whole site-packages tree and launches build_graph_from_path_async on it. That indexes every installed dependency — thousands of unrelated files — under a single Repository node named site-packages. It then also poisons the "already indexed" dedupe in indexing_handlers.py:92-97, since that entire path now registers as indexed.
six and typing_extensions are among the most commonly installed Python packages, so this is easy to hit.
Second, smaller bug in the same function
tools/package_resolver.py:43 — frozen stdlib modules (os, io, abc, … in CPython 3.11+) report spec.origin == "frozen" with no submodule_search_locations, so they resolve to None and the tool reports "Could not find package 'os'" for a module that plainly exists. Also reproduced above.
Suggested fix
For a single-file module, index the file, not its parent directory — or refuse with a clear message rather than silently widening the scope to the whole environment. Guard the fallback with a check that the parent is not a site-packages / dist-packages root.
Opened PR #1586. Added a guard so flat single-file packages like six.py return the file path instead of site-packages. Normal namespace packages are unaffected.
Activity
github-actions commentedon Aug 1, 2026
Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ
AloysJehwin commentedon Aug 5, 2026
Opened PR #1586. Added a guard so flat single-file packages like
six.pyreturn the file path instead ofsite-packages. Normal namespace packages are unaffected.chore(release): bump version to 0.5.7 (#1592)