codemap icon indicating copy to clipboard operation
codemap copied to clipboard

python: namespace packages below the repo root (src/, backend/) get no edge

Open JordanCoin opened this issue 1 month ago • 0 comments

Follow-up from the #272 review. A namespace package (no __init__.py) that is not at the repo root gets no edge:

backend/app/models.py
backend/main.py:   from app import models     # run from backend/
codemap --importers backend/app/models.py      # none

Same for src/nspkg (namespace package in a src layout) imported as from nspkg import m. In the first case nothing reports the edge as missing, because app is not top-level. pythonFromRoot in scanner/filegraph.go only checks a root-relative path for the namespace case. Main had the same behaviour; the first #272 commit linked these through the old fan-out.

Expected: resolve the namespace package against the same import roots as regular packages (src/, a script's directory), and when there's no match, report the edge as unresolved.

Part of #240.

JordanCoin avatar Nov 04 '26 00:11 JordanCoin