python / python/mypy

Manage `ignore_missing_imports = true` sections configs automatically

Offen
#10,044 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Feature

When I'm adding typing to an existing project, I encounter many libraries that don't have type hints. The easy solution to suppressing these errors is setting ignore_missing_imports = true, but this is not great. The recommended solution, assuming you don't want to write your own stubs, is to create separate sections for each such library. This can be cumbersome to create and manage.

I wrote myself a small tool that generates such configs: https://github.com/indigoviolet/mypy-missing-imports . I think it would be nice for mypy to include something like it, to make the "recommended" path easier to follow.

Pitch

I'm imagining something like

mypy --generate-missing-import-configs <optionally, /path/to/mypy.ini>

which would print out sections for each library identified as a [import] error like

[mypy-foo.*]
ignore_missing_imports = true

If passed a configuration file, it would update the corresponding sections in that file.

I'd be happy to try and add this to mypy if it is useful.

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

Beginne mit mypy's Befehlszeilenverarbeitung und Konfigurationsverarbeitung, wobei der vorgeschlagene Befehl mypy --generate-missing-import-configs und die optionale Eingabe mypy.ini als Einstiegspunkte dienen. Überprüfe das referenzierte Tool mypy-missing-imports hinsichtlich des vorgesehenen Verhaltens. Als abgeschlossen gilt die Aufgabe, wenn Abschnitte pro Bibliothek wie [mypy-foo.*] mit ignore_missing_imports = true generiert oder aktualisiert werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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