Failed to find exact letter case of module name when relative import on Windows OS
未关闭
还没有人认领这个 Issue。
bug
- 主要语言
- Python
- 星标
- 20.6k
- 派生
- 3.3k
- PR 合并指标
- PR 指标待抓取
描述
Bug Report
Failed to find exact letter case of module name when relative import on Windows OS.
To Reproduce
ModuleName
├─ __init__.py
├─ file.py
├─ main.py
# main.py
from .file import *
Everything is fine when the path is correct with letter case.
mypy .\ModuleName\main.py
Success: no issues found in 1 source file
But if the path of files is wrong with letter case,
mypy .\moduleName\main.py
but there will be an [import-not-found] error.
moduleName\main.py:1: error: Cannot find implementation or library stub for module named "moduleName.file" [import-not-found]
Your Environment
- Mypy version used: mypy 1.14.1 (compiled: yes)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 ModuleName/init.py、file.py 和 main.py 重现 Windows 的大小写不匹配问题,同时使用 main.py 中的相对导入和所示的两个 mypy 命令。跟踪命令行路径如何映射到模块名。完成的标准是:大小写不正确的路径能够解析相对导入,且不会出现 import-not-found 错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100