I'm working to get rid of the type checker-specific symbols that currently are in our core stubs but don't exist at runtime. I'll use this issue to track the work needed. This involves changes both to typeshed and to type checkers.
Affected names:
typing._TypedDict. Suggesting to rename to _typeshed.TypedDictFallback. (mypy and pyright)
typing._promote -> _typeshed._promote (mypy only)
typing.AwaitableGenerator -> _typeshed.AwaitableGenerator (mypy and pyright)
builtins.function (mypy and pyright). Need to look more into why we can't just use types.FunctionType.
- Working on this in mypy but it requires updating a ton of test cases
builtins.ellipsis (mypy and pyright). Should add a new name to _typeshed, similar to NoneType.
builtins.module was also mentioned in the past but it's been fixed already (mypy PR: python/mypy#3107).
Linked issues and PRs:
I'm working to get rid of the type checker-specific symbols that currently are in our core stubs but don't exist at runtime. I'll use this issue to track the work needed. This involves changes both to typeshed and to type checkers.
Affected names:
typing._TypedDict. Suggesting to rename to_typeshed.TypedDictFallback. (mypy and pyright)typing._promote->_typeshed._promote(mypy only)typing.AwaitableGenerator->_typeshed.AwaitableGenerator(mypy and pyright)builtins.function(mypy and pyright). Need to look more into why we can't just usetypes.FunctionType.builtins.ellipsis(mypy and pyright). Should add a new name to _typeshed, similar toNoneType.builtins.modulewas also mentioned in the past but it's been fixed already (mypy PR: python/mypy#3107).Linked issues and PRs:
functionfrom builtins #2999ellipsistype mypy#11564_typeshed._type_checker_internalshas now been added and I've announced it at https://discuss.python.org/t/removing-type-checker-internals-from-typeshed/87960/2. I suggest we wait for a few months and then start removing symbols one by one to judge the fallout. Current list:builtins.function#14957typing._promote#14958typing.AwaitableGenerator#14959typing.NamedTupletyping._TypedDict#14960