Infer `python_version` from `project.requires-python` when using pyproject.toml
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature
Per the docs, the [mypy] python_version configuration option defaults to "the version of the Python interpreter used to run mypy." We should change this so that it is instead derived from the project.requires-python when the mypy configuration itself is defined in a pyproject.toml file, similar to what ruff currently does for ruff.target-version.
Pitch
Using the system Python version is almost always the wrong thing to do when running against a package that specifies a minimum supported Python version via their pyproject.toml file. This necessitates use of the [mypy] python_version option, even though it (perhaps partially) duplicates information already available. Automatically detecting a value for [mypy] python_version when not explicitly specified would be a neat little UX win.
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 damit nachzuverfolgen, wie mypy seine Konfiguration aus pyproject.toml liest und die Option [mypy] python_version auflöst. Die Änderung ist abgeschlossen, wenn ein nicht angegebener Wert aus project.requires-python abgeleitet wird, während ein explizit konfiguriertes python_version weiterhin Vorrang hat; vergleiche das beabsichtigte Verhalten mit ruff.target-version.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 58/100