Support for `__builtins__.pyi`?
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature
In #12860 @erictraut said:
We decided to support this in pyright through the use of a specially-named builtins.pyi stub file. If a stub with this name is found within the root directory of a project, pyright treats any symbols declared within that stub as though they are appended to the bottom of builtins.pyi.
and @AlexWaygood closed the issue saying:
if anybody wants to request a mypy equivalent of the more limited feature Eric's introduced over at pyright, they can open another issue to do so.
I would like to request a mypy version of this feature, so that custom Python distributions that provide extra builtins can ship type definitions that are understood by mypy. In specific, I am interested in this because PyScript is discussing adding a builtin called display which is like a web aware print and they want to make it a builtin.
https://github.com/pyscript/pyscript/discussions/1687
It's worth pointing out that typescript also has a version of this feature with declare global. Though the JavaScript ecosystem also has a lot of tools that pollute the "builtins"-level scope so they have a much stronger need for this sort of thing.
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
Lies die referenzierten pyright-Dokumente unter docs/builtins.md und vergleiche das Verhalten von builtins.pyi mit mypys bestehender Behandlung von builtins.pyi. Verfolge, wie ein Projektstamm ermittelt wird und wie builtins-Definitionen geladen werden; abgeschlossen ist die Aufgabe, wenn ein benutzerdefinierter Stub auf Stammebene Symbole zur Typprüfung beiträgt und Tests dieses Verhalten abdecken.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100