Skip to content

Commit dd0a34f

Browse files
authored
Merge pull request #209 from DevanshuNEU/main
fix: resolve Python dotted imports in dependency analyzer
2 parents 86ef9c9 + 58d88fd commit dd0a34f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

backend/services/dependency_analyzer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ def _resolve_import_to_file(
227227
) -> str:
228228
"""Resolve an import to an actual file in the repo"""
229229

230-
# External dependency check
231-
if not import_path.startswith('.') and not import_path.startswith('/'):
232-
# Might still be internal for Python packages
233-
if '/' not in import_path:
234-
return None
230+
# Skip obvious external packages (stdlib, third-party without dots)
231+
# But allow dotted imports like 'starlette.exceptions' to be resolved below
232+
if not import_path.startswith('.') and '.' not in import_path and '/' not in import_path:
233+
# Single-word imports (os, sys, json) are always external
234+
return None
235235

236236
source_path = Path(source_file)
237237
source_dir = source_path.parent

0 commit comments

Comments
 (0)