Skip to content
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

Change import resolution order to select typeshed stdlib stubs later #2937

Closed
erictraut opened this issue Jan 26, 2022 · 2 comments
Closed
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request

Comments

@erictraut
Copy link
Collaborator

Currently pyright resolves imports in the following order:

  1. stdlib typeshed (from typeshedPath if specified, or from the bundled typeshed stubs otherwise)
  2. local stub (if stubPath is specified)
  3. execution environment root directory
  4. extraPath for execution environment
  5. stub packages installed in selected python environment
  6. normal (non-stub) packages installed in selected python environment
  7. stubs bundled with pylance (not present in pyright)
  8. third-party typeshed (from typeshedPath if specified, or from the bundled typeshed stubs otherwise)

PEP 561 suggests that stdlib typeshed stubs should be resolved between 7 and 8 in the above list. There were historical reasons why we always resolved them first.

This change would bring pyright into conformance with PEP 561.

@erictraut erictraut added the enhancement request New feature or request label Jan 26, 2022
@erictraut
Copy link
Collaborator Author

This will be included in the next release.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Jan 28, 2022
@erictraut
Copy link
Collaborator Author

This is included in pyright 1.1.216, which I just published. It will also be included in the next release of pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant