Open Akuli opened 3 years ago
This sounds reasonable to me. Tkinter somehow feels like a separate entity from the rest of the stdlib in my mind, even though it's included with CPython. It also has larger stubs than most stdlib packages, so it's perhaps likely that users would like to update tham. Though I rarely use tkinter, so take my opinion with a grain of salt.
My main worry is that this will be confusing to users who might not understand that tkinter is treated specially by typing. If we make this change, how should we communicate it to users?
Mypy would likely generate an error and suggest installing types-tkinter
if the stubs are missing, but the code being type checked imports it. We'd also mention this in the mypy release notes. I think that this would be self-explanatory. Tools that ship the entire typeshed shouldn't be affected at all.
I am not a big fan of this, after all tkinter is part of the stdlib. A similar rationale could be used for quite a few other stdlib modules, e.g. asyncio, statistics, curses, turtle, ssl. Why should they be part of the stdlib if ssl is not? But this begs another question: Could the stdlib be distributed separately from type checkers, with type checkers declaring a dependency?
I don’t have a strong opinion. I don’t write a lot of Python these days, much less with tkinter—I use it occasionally when a project calls for it, not on a day-to-day basis.
Here's another idea: why not auto-upload types-foo
packages of all stdlib modules? That way a project doesn't have to bundle typeshed in a git submodule just to use some fix in typeshed. Type checkers wouldn't have to suggest installing those automatically, because the stdlib bundled with the type checker is usually good enough.
While tkinter is technically stdlib, it feels like a third-party package in a couple ways:
We could consider moving tkinter stubs from
stdlib/
tostubs/
. This would create atypes-tkinter
project on pypi that is auto-updated when pull requests are merged, even though you aren't supposed topip install tkinter
.