python / python/mypy

mypy evaluates `files` config property relative to current working directory iso config file location

Offen
#18,809 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature topic-configuration
Vorherrschende Sprache
Python
Sterne
20.6k
Forks
3.3k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Bug Report

In https://github.com/python/mypy/pull/18482 support was added for walking up the file system to find the appropriate config file. I wanted to try this out, but ran into a problem.

The config file might contain a section files (and also exclude).
IMO the paths specified there should be considered relative to the location of the config file.

Instead mypy considers them relative to the current working directory (where mypy was invoked).
In order for the 'walk up' functionality to be useful the paths should be interpreted as relative to the config file location.

Actual Behavior

$ mypy
mypy: can't read file 'tests': No such file or directory

Your Environment

  • Mypy version used: 1.15
  • Mypy configuration options from mypy.ini (and other config files): files = tests

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Überprüfe PR 18482 und die Konfigurationsverarbeitung für mypy.ini, insbesondere die Optionen files und exclude. Reproduziere den Fehler aus einem Unterverzeichnis mit files = tests und verfolge anschließend, wie der Speicherort der Konfiguration und das aktuelle Arbeitsverzeichnis verwendet werden. Erledigt ist die Aufgabe, wenn konfigurierte Pfade relativ zur Konfigurationsdatei aufgelöst werden und das Verhalten durch Regressionstests abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.