Support for `lazy` imports (PEP 810, Python 3.15+)
Offen
Dieses Issue hat noch niemand übernommen.
feature
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Python 3.15 introduces PEP 810 - Explicit lazy imports via the new lazy soft keyword:
lazy import json
lazy from pathlib import Path
Currently mypy reports these as syntax errors. Support is needed to:
- Update the parser to recognise
lazy importandlazy from ... importstatements - Treat lazy imports the same as regular imports for type checking purposes (as noted in PEP 810 § Typing and tools)
Related:
- astral-sh/ruff#21305 (ruff tracking issue)
- astral-sh/ty#2968 (ty tracking issue)
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, die Parser-Unterstützung für die Anweisungen lazy import und lazy from ... import nachzuverfolgen, und folge dann dem Pfad der Typprüfung für reguläre Importe. Verwende den Abschnitt “Typing and tools” von PEP 810 als Verhaltensreferenz. Die Aufgabe ist abgeschlossen, wenn beide Formen akzeptiert und für die Typprüfung wie reguläre Importe behandelt werden, ohne Syntaxfehler zu erzeugen.
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
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 68/100