-
Notifications
You must be signed in to change notification settings - Fork 879
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
Don't mark re-exported symbols as unused (F401) #717
Comments
This is easy to implement! My only question is whether it should be the default behavior, or designated under its own lint rule so as to be configurable (or via a configuration option). Anyone have opinions on that? Maybe @andersk? |
I think this should be the default behavior since the re-export itself is effectively an explicit opt-in. |
I think I agree. Although this was rejected upstream (PyCQA/pyflakes#474), it’s a pretty important pattern in the typed Python ecosystem. (Upstream is incorrect to expect that ecosystem to be entirely captured in PEPs—this reexport convention needs no special support from the Python language itself or its runtime implementations.) And I don’t see this significantly hurting anyone else. |
Going out in v0.0.117 (building now). |
whoops, I should've probably mentioned the same holds for |
Also apparently |
Re-opening for those cases :) |
Interesting, Pyright rejects that. |
Yeah, Pyright seems more correct. Opened python/mypy#14086. |
Currently, an import in the form of:
will trigger F401, but this idiom is in widespread use as a type checker-friendly alternative to
__all__
which does not alter star import semantics. Type checkers which support flagging unused imports will ignore re-exported symbols, i.e. symbols where theas
target is identical to the original name:Thanks for ruff!
The text was updated successfully, but these errors were encountered: