Open davidhalter opened 4 years ago
Fair enough, these don't really belong to typeshed. Renaming ellipsis
to _ellipsis
should be pretty straightforward. It's somewhat non-trivial to modify mypy to not depend on the function
type, however. One idea would be to introduce a mypy-specific stub file that defines function
(such as _mypy_builtins
) and implicitly import that module within mypy.
We could do the underscore thing for _function
also, right?
I'm interested in pushing this through in order to help clean up typeshed. I need to think more about the exact approach, but some thoughts:
_typeshed
or use the existing public names (e.g. types.FunctionType
)builtins.function
, builtins.ellipsis
, typing.AwaitableGenerator
_typeshed.NoneType
for similar purposes.
- Affected names include
builtins.function
,builtins.ellipsis
,typing.AwaitableGenerator
There's also typing._TypedDict
— the comment in the typeshed stub implies that this is only used by mypy.
Pyright uses all four of these symbols too: builtins.function
, builtins.ellipsis
, typing.AwaitableGenerator
and typing._TypedDict
. If you're going to remove, move or rename these in typeshed, please let me know so I can update pyright's logic accordingly. Thanks!
There is also typing._promote
, which sets up a fake subclass relationship for mypy: https://mypy-play.net/?mypy=latest&python=3.10&gist=74f80ff35ef1f4edc66302c70a225b50
Fixing this issue will probably also fix
There are at least two classes in typeshed's
builtins.pyi
(class function
andclass ellipsis
, that should not belong there.The issues in typeshed are:
However, typeshed's CI will break if you still use these classes. Please find another way to implement this and let typeshed remove those classes (respectively rename ellipsis to _ellipsis).
The problem is that other software does depend on typeshed as well and for example Jedi this leads to bugs.