Incorrect diagnostic on missing submodule
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 20.6k
- Fork
- 3.3k
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 54
Mô tả
Bug Report
When untyped module exists but submodule does not, mypy reports that submodule is installed.
To Reproduce
$ pip install fabric
import fabric
from fabric.not_exists import something
$ python3 test.py
Traceback (most recent call last):
File "/media/sf_d/WWPass/git/spm/test.py", line 2, in <module>
from fabric.not_exists import something
ModuleNotFoundError: No module named 'fabric.not_exists'
$ mypy test.py
test.py:1:1: error: Skipping analyzing "fabric": module is installed, but missing library stubs or py.typed marker [import-untyped]
import fabric
^
test.py:2:1: error: Skipping analyzing "fabric.not_exists": module is installed, but missing library stubs or py.typed marker [import-untyped]
from fabric.not_exists import something
^
test.py:2:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 2 errors in 1 file (checked 1 source file)
Expected Behavior
Error in line 2 should be saying that fabric.not_exists does not exist.
Actual Behavior
Error in line 2 says that fabric.not_exists is installed, which it not true and misleading.
Your Environment
$ mypy --version
mypy 1.11.2 (compiled: yes)
$ python3 --version
Python 3.12.3
$ pip list | grep fabric
fabric 3.2.2
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện báo cáo bằng test.py được cung cấp, một gói fabric không có kiểu đã được cài đặt và việc import fabric.not_exists. Trước tiên, hãy lần theo quá trình phân giải import của mypy và chẩn đoán thiếu stub đối với các mô-đun lồng nhau; hoàn tất khi gói hiện có vẫn báo cáo cảnh báo hiện tại, trong khi mô-đun con bị thiếu nhận được lỗi rõ ràng cho biết nó không tồn tại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- devtools
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100