mypy
mypy copied to clipboard
Python 3.11 tracking issue
General, language:
- [x] Fix typed_ast support for Python 3.11 (fixed in 1.5.4)
- [x] Get tests running (#12833)
- [x] Unbreak mypyc (https://github.com/mypyc/mypyc/issues/931)
- [x] Fixes for asyncio.coroutine removal (#12834, #12917)
- [ ] Fix mypyc traceback tests
- [ ] Make tests on Python 3.11 required
- [ ] Run lxml tests on Python 3.11
- [ ] PEP 654 (exception groups)
- [ ] Support for new enum features (#12841)
- [ ] Add tests for the following language changes: https://github.com/python/cpython/issues/77527 , https://github.com/python/cpython/issues/90881
- [ ] Building wheels
- [ ] Adding classifier
New typing features:
- [x] PEP 655 (Required, NotRequired)
- [ ] PEP 646 (variadic generics)
- [ ] PEP 673 (Self type, #11871)
- [ ] PEP 675 (LiteralString, #12554, #12559)
- [ ] PEP 681 (dataclass_transform)
I started off writing a comment, but it got too long so I created a separate issue instead: there's a ton of new enum features in 3.11 that mypy doesn't yet support.
- #12841
Okay, we're down to four failing tests with Python 3.11:
FAILED mypyc/test/test_run.py::TestRun::run-misc.test::testCheckVersion
FAILED mypyc/test/test_run.py::TestRun::run-classes.test::testProtocol
FAILED mypyc/test/test_run.py::TestRun::run-classes.test::testPickling
FAILED mypyc/test/test_run.py::TestRun::run-classes.test::testProperty
#13125 takes care of testCheckVersion testProperty seems trivial, just a difference in traceback formatting testPickling is probably https://github.com/python/cpython/issues/70766 and not too bad testProtocol looks a little scary — seems like one we'd want to fix
@97littleleaf11 any interest in taking a look at the testProtocol failure? :-)
#13206 should fix testProtocol and testPickling beta5 has some new test failures (that are my fault from https://github.com/python/cpython/pull/94948 ), these ones are very easy to fix
Okay, CPython has rolled back changes, see https://github.com/python/cpython/issues/92678 and https://github.com/python/cpython/issues/95589. We should still confirm that with RC or B6 or whatever, we'll just have testProperty failing.
If you want to link the PEP 673 issue, it's here: https://github.com/python/mypy/issues/11871
Okay, with RC1 we have the following tests failing:
testPickling: probably related to https://github.com/python/cpython/issues/70766 (although not sure why #13206 "fixed" this)
testProperty: as mentioned above, just a difference in traceback formatting
testConfigFollowImportsSysPath: looks like something might have changed in mypy type logic and we now detect an overload situation in typeshed 3.11-only code
Hypothetically speaking, if I wanted to add support for dataclass_transform, would that be a possibility? does it need some kind of approval to even begin? Is it being worked on already?
It is not being worked on as far as I am aware, and you don't need approval, feel free to get started on working on it if you are interested! We use a mypy plugin to analyze dataclasses so you'll probably want to start there https://github.com/python/mypy/blob/master/mypy/plugins/dataclasses.py
Since Python 3.11, Any is considered to be a base class. As stated here, mypy doesn't seem to support this feature yet when using NewType:
T = NewType("T", Any)
> error: Argument 2 to NewType(...) must be subclassable (got "Any") [valid-newtype]
The issue was closed as wontfix but maybe this can now be supported?
Added #14293 for PEP 681 so that we can track it 😄
What about the changes to Concatenate introduced by https://github.com/python/cpython/pull/30969? (https://github.com/python/mypy/issues/14656)
I believe we can consider dataclass_transform supported now
For completeness' sake, here's the PEP 646 issue: https://github.com/python/mypy/issues/12280
I don't think we need to keep this open. Almost everything is now implemented, and for couple remaining things we have dedicated issues.