-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Make --no-implicit-reexport
friendlier
#13965
Comments
This is the same thought process we went through in pyright. In earlier versions, all implicitly re-exported symbols from a "py.typed" library evaluated to |
#13933 is a good example of the perils of the current behavior. I agree with your suggestion. |
Fixes some of python#13965 We also need to modify attribute access logic (this is the TODO in the PR), which is a little trickier. But cases like python#13933 convinced me it's worth making this change, even before I get around to figuring that out.
Out of curiosity, is it a recent behavior that |
@emirkmo please file a separate issue with details about what you're doing |
Currently, users have to pay double jeopardy if they rely on an implicit reexport. First, they get an error "module does not explicitly export attribute [attr-defined]", but then the type of the thing also becomes Any.
I think it would be friendlier to have mypy just use the type of the hidden thing. This is useful in cases where you can't change the module you're importing from. In some cases, you can have a per-module implicit_reexport config (although I'd argue most users would struggle to find that solution), but in some "consenting adults" situations this isn't quite what you want.
Here's what the patch could look like for the semanal portion of this (edit: merged!). We'd also need to modify attribute access logic.
The text was updated successfully, but these errors were encountered: