Skip to content

proper Python AST parser for more accurate import detection #70

@DimitriGilbert

Description

@DimitriGilbert

CodeRabbit
Consider improving import detection robustness.

The current regex-based approach for detecting imports has limitations:

Won't detect multi-line imports like from package import (a, b, c)
Could match imports within strings or comments
Doesn't handle __import__() or importlib usage
Consider using a proper Python AST parser in the future for more accurate import detection. For now, document these limitations in a comment:

   analyzeImports(code: string): string[] {
+    // Note: This regex-based approach has limitations and won't catch all import patterns
+    // Future improvement: Use Python AST parsing for accurate import detection
     const lines = code.split('\n');
     const requiredPackages = new Set<string>();

if bots catch the stuff i was pushing under the rug... DavidGoodenough

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions