Treat relative paths in config file relative to config file, not cwd
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
When using mypy_path = src it should be treated relative to the config file (if any), not the current working directory.
This also applies to the default of cache_dir (.cache_dir), which currently gets created in the current working directory always.
I.e. a detected/found (project) config file could be treated as the root for options with relative defaults also.
As for mypy_path this could be achieved in the type callback, which then however would need the config file / root as a new argument:
https://github.com/python/mypy/blob/84126ab9985844d8cda3809688034af895fdaf7c/mypy/config_parser.py#L75
As for global user config files, it should treat relative files therein relative to it, but it should not be used as a root for default settings like cache_dir.
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 in mypy/config_parser.py beim type callback in Zeile 75 und verfolge, wie das erkannte Root-Verzeichnis der Projektkonfiguration an die Optionsverarbeitung übergeben wird. Überprüfe, dass relative mypy_path-Werte und cache_dir-Standardwerte das Verzeichnis der Projektkonfiguration verwenden, während relative Pfade in globalen Benutzerkonfigurationsdateien das Verzeichnis dieser Datei verwenden, ohne es zum Root-Verzeichnis für Standardeinstellungen zu machen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100