-
-
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
Should stubtest verify the presence of __all__
in a stub?
#13300
Comments
Perhaps we can complain about the absence of |
I'm less concerned about a user doing (also referencing this typeshed discussion: python/typeshed#6810 ) |
I now have an actual example where enforcing this would've helped a typeshed contributor other than myself: python/typeshed#10544 (comment) |
I think we should just bite the bullet here and start warning when |
It shouldn't be too hard to add progressively with |
Previously it wasn't an error if runtime included an `__all__` declaration, but the stubs did not. This PR changes this to reflect the consensus that it would be a good idea to ensure consistency in this case. Fixes #13300
See #12214
Currently, stubtest will not ensure that
__all__
is present in the stub if it is present at runtime.We will always check whether the stub has the symbols we need, so ensuring that
__all__
is in the stub may just cause additional busywork for maintainers of stubs.However, users may do
module.__all__
at runtime. If stubtest doesn't ensure that__all__
is present in the stub, this means such users could get false positives when using such stubs.However, if
__all__
isn't in__all__
is it a public API? stubtest will ensure that__all__
is present in the stub if__all__
is in__all__
.Anyway, busywork is my main concern here. The change itself is very easy: 02b4f14
The text was updated successfully, but these errors were encountered: