Skip to content

fix typing-extensions stubs shadowing typing_extensions #5109

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

Closed
wants to merge 2 commits into from

Conversation

chdsbd
Copy link
Contributor

@chdsbd chdsbd commented Mar 12, 2021

It's not possible to use stubs that depend on types-typing-extensions because mypy doesn't allow stubs to override typing-extensions.

The solution is to require typing-extensions instead of types-typing-extensions since mypy and pyright have built in types for this package.

fixes #5065

Comment on lines +176 to +177
if dep in ALLOWED_PACKAGES:
continue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure how to handle this lint.

@chdsbd
Copy link
Contributor Author

chdsbd commented Mar 12, 2021

I tested and the stubs uploader doesn't like this yet. nvm

@chdsbd chdsbd marked this pull request as draft March 12, 2021 02:10
@chdsbd
Copy link
Contributor Author

chdsbd commented Mar 12, 2021

@chdsbd chdsbd marked this pull request as ready for review March 12, 2021 02:20
# mypy does not support stubs for typing-extensions, so we depend on
# `typing-extensions` instead of `types-typing-extensions`.
"typing-extensions"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to disallow types-typing-extensions.

@chdsbd
Copy link
Contributor Author

chdsbd commented Mar 20, 2021

@srittau I wasn't sure which core team member to ping, but can I get a review on this? No rush.

@hauntsaninja
Copy link
Collaborator

I don't know that this is the right fix. The proximate cause of your issue is that mypy hasn't released a version that supports modularised typeshed; if you use mypy master I believe things should work for the issue you filed.

I'd actually be pretty in favour of pretending typing-extensions is a stdlib module (and I think there are a couple good potential reasons to do this).

@chdsbd
Copy link
Contributor Author

chdsbd commented Mar 22, 2021

@hauntsaninja Should I close this PR and wait for mypy to release? Or can we merge this change?

@JukkaL
Copy link
Contributor

JukkaL commented Mar 22, 2021

Let's wait for the mypy release and see if there still is an issue.

@hauntsaninja
Copy link
Collaborator

Obviated by #5233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typing_extensions-stubs shadowing typing_extensions
3 participants