-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for __builtins__.pyi
?
#16078
Comments
Suggestion: Modify the title to,
...as that's the actual name of the file that pyright supports, and if mypy ever does come to support this feature, it makes sense to use the same filename rather than fracturing things. |
That being said,
...AIUI not even pyright's current feature would support that use case. They look for a To achieve what you're looking for, IIUC both pyright and mypy would require feature requests for new (in mypy) or expanded (in pyright's case) |
I could see a more general feature that would cover this use case: a way to provide the type checker with an "overlay" over an existing stub that adds additional features. This could be useful not only for your use case, but also e.g. for patching over an incorrect stub provided by a library. Some of the pytype folks have been talking about such a feature, but not sure they'll have time to push it forward. |
Also useful for monkey-patching. |
It is, but... that's also been one of the arguments against supporting it. If you read @erictraut's #12860 (comment) in the issue that spawned this one... well, I'll quote it here (up to the point where @hoodmane's quote starts above):
|
(Such a legit usage is exactly the inspiration for @hoodmane's request. Which, come to think of it, makes it a bit weird if pyright really doesn't support a centralized |
Feature
In #12860 @erictraut said:
and @AlexWaygood closed the issue saying:
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 awareprint
and they want to make it a builtin.pyscript/pyscript#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.The text was updated successfully, but these errors were encountered: