Description
I've had a certain annoying pain point for quite some time with typeshed stubs.
From microsoft/pylance-release#5209 :
I'd expect absolute imports to find symbols from typeshed's own stubs, and "Go to type definition" to lead to typeshed's own
.pyi
(when it exists) instead of the installed library.Here's a couple example:
When new modules get added (or a new stub gets worked on, which is full of new modules):
pip install types-*
inside typeshed is of limited use [...]
when the stub library, or the module, doesn't exist yet. Or even if the current module is being modified in an incompatible manner (like adding generics to class).
One option is to use relative imports, but that can lead to going up many parents, and doesn't solve the issue when writing tests (all the openpyxl tests I wrote were painful because I could not trust my editor).
Another possible solution brought by Eric Traut:
[...] Perhaps you could use an editable install when developing the stub package?
I don't have the most experience working with editable installs, but that would require writing a pyproject.toml
for each stub right? Could it be done dynamically with a script?
I'd love to hear thoughts and experiences from other contributors. Especially if you use different tooling than I do (VSCode+Pylance)
Ref.: #8774