Disappearing dmypy errors using `--export-types`, `pip install -e`, and absolute paths
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug Report
Errors disappear on the second run of dmypy under specific circumstances:
- Dmypy is run using the
--export-typesflag. - We use absolute paths to the files checked.
- The files checked are in a project which has been installed with
pip install -e. - The files checked are in a
srcdirectory. (This is so odd that I feel as though I might have made a mistake here.)
This looks similar to https://github.com/python/mypy/issues/9655, but unlike that, this isn't fixed by https://github.com/python/mypy/pull/15043 (see https://github.com/python/mypy/pull/15043#issuecomment-1884022976).
To Reproduce
The best minimal example I have so far:
pyproject.toml:
[build-system]
requires = ["setuptools >= 64"]
build-backend = "setuptools.build_meta"
[project]
name = "dmypy_example"
version = "0.0.1"
dependencies = []
src/foo.py:
a: str = 1
Commands:
# Create a new Python 3.12 virtualenv, then:
pip install --editable .
dmypy run --export-types $(pwd)/src/foo.py
dmypy run --export-types $(pwd)/src/foo.py
Expected Behavior
We should see the same error output after both runs of dmypy.
Actual Behavior
Regardless of the error in the file, it disappears on the second run of dmypy.
$ pip install --editable .
...
$ dmypy run --export-types $(pwd)/src/foo.py
Daemon started
src/foo.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment]
Found 1 error in 1 file (checked 1 source file)
$ dmypy run --export-types $(pwd)/src/foo.py
Success: no issues found in 1 source file
Your Environment
- Mypy configuration options from
mypy.ini(and other config files): None. - Python version used: 3.12.
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
Beginne mit dem minimalen Beispiel in pyproject.toml und src/foo.py, installiere es mit pip install --editable ., und führe die beiden dmypy-Befehle genau wie gezeigt aus. Vergleiche die ersten und zweiten Ergebnisse des Daemons, während du die Kombination aus --export-types, absolute-path, editable-install und src-directory nachverfolgst. Als abgeschlossen gilt die Aufgabe, wenn der Typfehler bei beiden Durchläufen sichtbar bleibt.
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
- 45/100