Remove type checker-specific symbols from builtins.pyi and typing.pyi
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
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.- 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 toNoneType.
builtins.module was also mentioned in the past but it's been fixed already (mypy PR: https://github.com/python/mypy/pull/3107).
Linked issues and PRs:
- #2999
- #3556
- #3932
- python/mypy#11564
- python/mypy#8240
- https://github.com/python/mypy/issues/2765
- https://github.com/python/mypy/issues/8699
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with builtins.pyi and typing.pyi, then review the linked typeshed and type-checker issues to understand the required replacements. Check the affected mypy and pyright behavior and test cases, especially the builtins.function cases. Done means the type-checker-specific symbols are removed from the core stubs and the affected type-checker tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100