Closed
Description
The structure of typeshed is changing, and tools are no longer expected to bundle the entire typeshed. Instead, users will install relevant PEP 561 stub distributions for the packages that they need.
Typeshed will continue to host third-party package stubs, and updates to third-party stubs will automatically uploaded to PyPI.
This will affect mypy in several ways:
- Mypy will only ship with stdlib stubs.
- Stubs for most third-party packages must be installed using pip, e.g.
pip install types-requests
for stubs forrequests
. - Typeshed will no longer be a git submodule. Instead, we'll copy the stdlib stubs to the mypy repository.
This has some major benefits:
- It's easy to start using new stubs, or a new version of existing stubs, contributed to typeshed. Users don't need to wait for the next mypy release -- they can just install or update the relevant stubs.
- Users no longer have to update to the latest stubs when updating mypy. This can save a lot of friction, since new stubs may have errors, and updating to stubs with stricter types (even if they are precise) may require significant changes to code that uses the relevant features.
- This makes things more consistent. Currently some third-party stubs are bundled with mypy, while some must be installed from PyPI. In the future all third-party stubs are installed in a similar way using pip.
- It will be easier to maintain multiple versions of stubs (for example, separate stubs for versions of 1.x and 2.x of a library).
We can make the transition relatively smooth by suggesting how to install the relevant stubs when the stubs are missing. We can also support automatically installing the necessary stubs (mypy --install-stubs
).
Discussion about the typeshed change, including motivation: python/typeshed#2491