-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Run mypy and pyright on our py312 stubs in CI #10119
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
Conversation
stdlib/configparser.pyi
Outdated
@@ -29,6 +29,9 @@ __all__ = [ | |||
"MAX_INTERPOLATION_DEPTH", | |||
] | |||
|
|||
if sys.version_info >= (3, 12): | |||
__all__.remove("SafeConfigParser") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that supported? I think we should instead .append it if we're below 3.12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was, but can't immediately find the reference, and I guess it's better to be safe than sorry :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least typeshed-client only supports +=
, and that's the only operation used in any existing stub in typeshed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like pyright definitely supports it: https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface
But whereas I can see code in mypy/semanal.py
that specifically deals with __all__.append
and __all__.extend
...
https://github.com/python/mypy/blob/6b1fc865902bf2b845d3c58b6b9973b5a412241f/mypy/semanal.py#L4881-L4895
...I can't find any equivalent handling of __all__.remove
in mypy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add a lint to flake8-pyi so that it forbids operations on __all__
unless they're known to be supported by all major type checkers (and typeshed-client).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the mypy code they also support .append
and .extend
but not .remove
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Depends on #10117