Mypy does not recheck files when follow_imports changes for dependencies
Offen
Dieses Issue hat noch niemand übernommen.
bug
priority-0-high
topic-fine-grained-incremental
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Problem mit test.py, mypy.ini und dem Verzeichnis .mypy_cache/ anhand der gezeigten Konfigurationsschritte. Beginne damit, die Cache-Invalidierung für Abschnitte [mypy-PATTERN] nachzuverfolgen, und vergleiche sie mit Änderungen im Hauptabschnitt [mypy]. Als erledigt gilt die Aufgabe, wenn eine Änderung am Pattern-Abschnitt dazu führt, dass mypy das fehlende Modul foo meldet, ohne den Cache manuell zu löschen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 48/100