From e0b5a705de94181fe5f80ffec44c4577122eb407 Mon Sep 17 00:00:00 2001 From: Devanshu Rajesh Chicholikar Date: Mon, 12 Jan 2026 19:16:30 -0500 Subject: [PATCH] fix: resolve Python dotted imports in dependency analyzer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: imports like 'starlette.exceptions' were treated as external because early return checked for '/' but not '.' in import path Fix: only treat single-word imports (os, json) as external Allow dotted imports to reach resolution logic that converts 'starlette.exceptions' → 'starlette/exceptions.py' --- backend/services/dependency_analyzer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/services/dependency_analyzer.py b/backend/services/dependency_analyzer.py index 47d57aa..bad75a8 100644 --- a/backend/services/dependency_analyzer.py +++ b/backend/services/dependency_analyzer.py @@ -227,11 +227,11 @@ def _resolve_import_to_file( ) -> str: """Resolve an import to an actual file in the repo""" - # External dependency check - if not import_path.startswith('.') and not import_path.startswith('/'): - # Might still be internal for Python packages - if '/' not in import_path: - return None + # Skip obvious external packages (stdlib, third-party without dots) + # But allow dotted imports like 'starlette.exceptions' to be resolved below + if not import_path.startswith('.') and '.' not in import_path and '/' not in import_path: + # Single-word imports (os, sys, json) are always external + return None source_path = Path(source_file) source_dir = source_path.parent