-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Distribute stdlib types as types-stdlib #5835
Comments
Wouldn't it be better to go with a pre release suffix first, then start with But I definitely like the idea 👍 |
We don't do that with third-party stubs either, since the third element has no influence on the API. Also, 3.10.0, for example, would not be a pre-release from typeshed's view. 3.10.x stubs are also viable for Python 3.9 and before, but additionally support Python 3.10. |
Idea: Rename |
I would find this very useful, and pyanalyze would definitely use it. Currently I have to manually make a new release of https://github.com/JelleZijlstra/typeshed_client when I need it. It might be better to use calendar-based versioning for the stdlib stubs. Using the Python version will likely confuse users into thinking that they can't use types-stdlib 3.11.x yet if they're still on 3.10. And we tend to add features from new Python versions gradually; there really isn't a clear point where it makes sense to increment a major version number. |
Definitely agree on not using Python version for versioning here. On the overall proposal, I'm a little hesitant, since type checkers are in fact coupled to standard library stubs: it's pretty common for PRs to typeshed to require changes to pyright, mypy and pytype. So while it's straightforward enough to decouple distribution, I'm not sure how we'd actually decouple semantics. I'll also note that in my experience, users are really bad at managing typing dependencies. Most users don't pin stub packages (if they even know they exist) and are really slow to upgrade mypy. I've encountered several users of mypy versions from before I starting contributing to typeshed or mypy! So I'm vaguely worried about the potential for situations like someone ending up pulling in a new types-stdlib and an old mypy and having a bunch of things inferred as Any. We've already had this situation with third party stubs, but the impact on users is much worse for stdlib. But maybe my fear is unfounded. And none of my fear applies if we consider this opt-in for tools that would find automatic packaging useful and we don't necessarily expect type checkers to support swapping out stdlib. |
I had the same thought just a few days ago, so that's a +1 from me. |
While the situation has improved significantly over the last few years, I believe that for the time being, type checkers should either keep bundling typeshed or pin it to a specific "known good" version. As typing stabilizes, we can discuss a stability guarantee. |
It would be nice if type checkers simply offered a configuration option that makes them use Currently you have to include typeshed as a Git submodule and point mypy at it with |
Two more thoughts: Instead of starting with e.g. We should release a new |
This has been briefly discussed before, but I think it would be a good idea if we started distributing the stdlib types in a separate package
types-stdlib
, similar to third-party packages:types-stdlib
package, for example if they are relying on_typeshed
features or for cases like Add setuptools stubs #5762. Type checkers that opt to distribute a copy of the stdlib, could warn if incompatible stubs are used.Technical considerations:
types-stdlib 3.10.X
, whereX
is incremented automatically. We should probably increment the version number as soon as the first beta is released and we are reasonably sure we have added all new/changed API.stdlib
, or even a non-importable name liketypes-stdlib
(so we'd have stubsstdlib/sys.pyi
etc.) so that they are only used by type checkers that support this package and don't interfere.The text was updated successfully, but these errors were encountered: