8000 Run mypy and pyright on our py312 stubs in CI by AlexWaygood · Pull Request #10119 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 7 commits into from
Apr 30, 2023

Conversation

AlexWaygood
Copy link
Member

Depends on #10117

@@ -29,6 +29,9 @@ __all__ = [
"MAX_INTERPOLATION_DEPTH",
]

if sys.version_info >= (3, 12):
__all__.remove("SafeConfigParser")
Copy link
Member

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.

Copy link
Member Author

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 :)

Copy link
Member

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.

8000 Copy link
Member Author

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.

Copy link
Member Author
@AlexWaygood AlexWaygood Apr 30, 2023

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).

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit 2c34496 into python:main Apr 30, 2023
@AlexWaygood AlexWaygood deleted the 312-prep branch April 30, 2023 14:31
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.

2 participants
0