DimitriGilbert / DimitriGilbert/LiteChat

proper Python AST parser for more accurate import detection

Open
#70 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
52
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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:
```diff
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();
```

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.