python / python/mypy

Decide what to do with get_additional_deps() plugin hook

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

Dieses Issue hat noch niemand übernommen.

parallel checking topic-plugins
Vorherrschende Sprache
Python
Sterne
20.6k
Forks
3.3k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

This hook is called in the coordinator with the parsed tree, but we don't want to deserialize trees in coordinator. It is currently used by mypyc, but it only accesses fullname on it. I recently recommended his hook in https://github.com/python/mypy/issues/17410 so it may be used by some plugins.

This hook is also used by the old NumPy plugin (in a somewhat controversial way). However, it looks like it can be fixed (in the sense that it will not immediately crash) by simply doing tree.defs = tree.imports.copy() before calling the hook.

I propose to make something like this documented behavior: i.e. explicitly say in the docs that the hook will be given partially parsed tree where only imports are available, the caller may then add extra dependencies judging from those imports.

It would be unfortunate to break plugins, but I don't see other options yet.

cc @JukkaL

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 der Überprüfung des Coordinator-Aufrufs von get_additional_deps() und seiner aktuellen Nutzer in mypyc und dem alten NumPy-Plugin. Ermittle, ob der Hook einen teilweise geparsten Baum mit verfügbaren Imports erhalten sollte, und dokumentiere das festgelegte Verhalten sowie die Kompatibilitätsauswirkungen für Plugins.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
devtools
Issue-Typ
Dokumentation
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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