-
Notifications
You must be signed in to change notification settings - Fork 765
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
Feature request: When setting python.analysis.typeshedPaths
, use its stubs for typing absolute imports
#5209
Comments
What you're proposing would violate PEP 561, which says that typeshed stubs should always be resolved last. If you want a stub package to override the library's own type information, you can install the stub library in your Python environment. As you can see from PEP 561, stub libraries are resolved before normal packages. All of the typeshed third-party stubs are regularly published as stub packages in pypi, so installing them in your environment is easy to do. |
That can't be done 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). My request is for development within typeshed itself in mind. If it's really not possible that's fine. I was looking for improvements of the dev experience in typeshed (which I know is a special case when it comes to stub repos) |
This is very specific to your particular use case. I don't think we should implement hacks or exceptions (violations of PEP 561) specifically for this. Perhaps you could use an editable install when developing the stub package? |
For posterity, exploring a solution using
|
After further exploration, my issue specific to redis might be due to the base library being marked as For the new stubs networkx: It's still bundled from microsoft/python-type-stubs , deleting it from the bundled pylance stubs fixed the linking issue to local typeshed stubs. identical openpyxl issues I had in the past: same story as networkx probably. Before it was removed from microsoft/python-type-stubs
If there is no action to be taken by pylance upon those two points. Please close this issue. I think I've just unfortunately been hitting all the specific edge cases leading me to believe this was a more widespread issue. |
For example, in typeshed repository, I have the following configured:
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):
Here's the full config:
The text was updated successfully, but these errors were encountered: