-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Use modular typeshed (unbundle third-party package stubs) #9973
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. thanks!
docs/source/getting_started.rst
Outdated
|
||
.. note:: | ||
|
||
Starting in mypy 0.800, most third-party package stubs must be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you mean 0.900 here too.
docs/source/command_line.rst
Outdated
|
||
.. note:: | ||
|
||
This is new in mypy 0.800. Previous mypy versions included a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you mean 0.900 here.
It can used in a normal mypy run (missing stub packages will be installed at the end). We also record the missing stub packages in a file so that another "mypy --install-types" run (with no other arguments) can be used to just install stub packages, without type checking anything.
They are actually 3rd party modules, but they are special like some stdlib modules so we bundle them with mypy.
This avoids picking up the backport of dataclasses when type checking in Python 3.7 mode. It will still be picked up in Python 3.6 mode.
This is currently needed for six.
Source commit: python/typeshed@eb9d995
This was changed recently.
Typeshed doesn't support 3.5 any more.
4a59d20
to
89c7184
Compare
I rebased and force pushed in the hope of fixing the brokenness. |
I'm going to ignore the mypy primer failures for now. If they persist, I'll disable mypy primer temporarily. |
Is the idea here that we don't want to include all of typeshed for releases? If that is the case we can keep the submodule and only include the stdlib folder in typeshed I believe (which would be a bit easier I think). E.g. If we change this line to point to the stdlib folder of typeshed only that will be included on install. |
That's part of it, but it's not the only thing. Now that we only need the stdlib stubs, the size is small enough that we can reasonably just commit them all in the repo. This lets us drop the submodule, which simplifies workflows a little -- especially for new contributors who might have no previous experience with git submodules. Also, if modular typeshed is successful, we'll eventually have 10x the current number of third-party stubs, and having so many stubs (that we don't need) inside the mypy repo, even as a submodule, could be awkward. |
This is a follow up for #9973 Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
These are no longer relevant after we removed the typeshed submodule in #9973.
These are no longer relevant after we removed the typeshed submodule in #9973.
Support the new structure of typeshed (python/typeshed#2491) and only
bundle stdlib stubs with mypy.
Most stubs for third-party packages now need to be installed using pip (for
example,
pip install types-requests
). Add stubs fortyping_extensions
and
mypy_extensions
as mypy dependencies, since these areneeded for basic operation.
Suggest a pip command to run if we encounter known missing stubs.
Add
--install-types
option that installs all missing stub packages. Thiscan be used as
mypy --install-types
to install missing stub packages fromthe previous mypy run (no need to provide a full mypy command line).
This also replaces the typeshed git submodule with a partial copy of the
typeshed that only includes stdlib stubs.
Add a script to sync stubs from typeshed (
misc/sync-typeshed.py
).This is still incomplete since typeshed hasn't actually migrated to the new
structure yet.
Work towards #9971.