Skip to content
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

Basic support for Python 3.11's typeshed #12220

Closed
hauntsaninja opened this issue Feb 20, 2022 · 7 comments
Closed

Basic support for Python 3.11's typeshed #12220

hauntsaninja opened this issue Feb 20, 2022 · 7 comments
Assignees
Labels
bug mypy got something wrong

Comments

@hauntsaninja
Copy link
Collaborator

Currently, running mypy with Python 3.11 on typeshed fails. We should fix it, ideally before the next mypy release.

These should help:
python/typeshed#7314
python/typeshed#7318

Looks like some generic type stuff is still broken:

stdlib/builtins.pyi:1710: error: Value of type "Type[type]" is not indexable  [index]

There are changes to use @property in enum that mypy doesn't like. Lucky for us @sobolevn is really good at fixing enum issues :D

stdlib/enum.pyi:103: error: Decorated property not supported  [misc]
stdlib/enum.pyi:105: error: Decorated property not supported  [misc]
stdlib/enum.pyi:131: error: Decorated property not supported  [misc]
stdlib/enum.pyi:148: error: Signature of "value" incompatible with supertype "Flag"  [override]
stdlib/enum.pyi:159: error: Decorated property not supported  [misc]
stdlib/enum.pyi:161: error: Decorated property not supported  [misc]
stdlib/enum.pyi:189: error: Decorated property not supported  [misc]
@hauntsaninja hauntsaninja added the bug mypy got something wrong label Feb 20, 2022
@hauntsaninja
Copy link
Collaborator Author

To repro:

diff --git a/tests/mypy_test.py b/tests/mypy_test.py
index 4d2c77a6..f243b59d 100755
--- a/tests/mypy_test.py
+++ b/tests/mypy_test.py
@@ -285,7 +285,7 @@ def test_third_party_distribution(distribution: str, major: int, minor: int, arg
 def main():
     args = parser.parse_args()
 
-    versions = [(3, 10), (3, 9), (3, 8), (3, 7), (3, 6), (2, 7)]
+    versions = [(3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6), (2, 7)]
     if args.python_version:
         versions = [v for v in versions if any(("%d.%d" % v).startswith(av) for av in args.python_version)]
         if not versions:

and then python3.11 ~/dev/typeshed/tests/mypy_test.py --python-version 3.11

@sobolevn sobolevn self-assigned this Feb 20, 2022
@sobolevn
Copy link
Member

I have some crazy stuff going on, so I am not really active right now.
But, I will have a look somewhere this week! 👍

Thanks for the repro!

@AlexWaygood
Copy link
Member

AlexWaygood commented Feb 20, 2022

(Note that the changes in enum are that the enum module in 3.11 started using @enum.property (not @builtins.property!))

@AlexWaygood
Copy link
Member

AlexWaygood commented Feb 26, 2022

python/typeshed#7389 gets rid of most of the remaining errors reported by mypy.

@AlexWaygood
Copy link
Member

I've filed #12258 to track the last remaining error when running mypy's master branch on the 3.11 typeshed stubs.

@AlexWaygood
Copy link
Member

Now that #12260 is merged, it looks like typeshed's 3.11 stdlib passes a mypy type-check when using the mypy master branch 🥳

@hauntsaninja
Copy link
Collaborator Author

Awesome, thanks both!

AlexWaygood added a commit to python/typeshed that referenced this issue Mar 13, 2022
* Run mypy on the 3.11 stdlib in CI, as a regression test for python/mypy#12220
* Correct the docstring at the top of the file following the changes made in #7478
* Stop the test from crashing when run locally if there's an extra file/folder in the stubs directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

3 participants