Mypy does not recheck files when follow_imports changes for dependencies
Đang mở
Chưa có ai nhận issue này.
bug
priority-0-high
topic-fine-grained-incremental
- 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ả
Steps to reproduce
- Create module test.py with import from nonexistent module:
from foo import bar
- Create mypy.ini file:
[mypy]
[mypy-foo]
ignore_missing_imports = True
- Run
mypy
$ mypy test.py
Success: no issues found in 1 source file
- Comment out
[mypy-foo]section in mypy.ini
[mypy]
# [mypy-foo]
# ignore_missing_imports = True
- Run
mypy
$ mypy test.py
Success: no issues found in 1 source file
Expected result
After step 4, mypy should detect config change and (partially?) invalidate cache, leading to a type error.
$ mypy test.py
test.py:1: error: Cannot find module named 'foo'
test.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
Notes
- Deleting
.mypy_cache/and re-runningmypyfixes the issue. - Adding/removing
ignore_missing_importsin the main[mypy]section does seem to invalidate the cache as expected. So this issue only seems to apply to[mypy-PATTERN]sections.
Versions
$ python --version
Python 3.7.3
$ mypy --version
mypy 0.740
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 vấn đề với test.py, mypy.ini và thư mục .mypy_cache/ bằng các bước cấu hình được cung cấp. Bắt đầu bằng cách theo dõi việc vô hiệu hóa cache đối với các section [mypy-PATTERN] và so sánh với những thay đổi trong section chính [mypy]. Được coi là hoàn tất khi việc thay đổi section pattern khiến mypy báo cáo module foo bị thiếu mà không cần xóa cache thủ công.
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 48/100