mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Python 3.11 tracking issue

Open hauntsaninja opened this issue 3 years ago • 7 comments

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)

hauntsaninja avatar May 22 '22 09:05 hauntsaninja

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

AlexWaygood avatar May 22 '22 10:05 AlexWaygood

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

hauntsaninja avatar Jul 15 '22 05:07 hauntsaninja

@97littleleaf11 any interest in taking a look at the testProtocol failure? :-)

hauntsaninja avatar Jul 16 '22 05:07 hauntsaninja

#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

hauntsaninja avatar Jul 27 '22 23:07 hauntsaninja

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.

hauntsaninja avatar Aug 05 '22 08:08 hauntsaninja

If you want to link the PEP 673 issue, it's here: https://github.com/python/mypy/issues/11871

NeilGirdhar avatar Aug 08 '22 19:08 NeilGirdhar

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

hauntsaninja avatar Aug 10 '22 20:08 hauntsaninja

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?

yoni-lavi avatar Nov 18 '22 15:11 yoni-lavi

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

emmatyping avatar Nov 18 '22 17:11 emmatyping

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?

Viicos avatar Nov 30 '22 20:11 Viicos

Added #14293 for PEP 681 so that we can track it 😄

NeilGirdhar avatar Dec 14 '22 07:12 NeilGirdhar

What about the changes to Concatenate introduced by https://github.com/python/cpython/pull/30969? (https://github.com/python/mypy/issues/14656)

randolf-scholz avatar Feb 08 '23 22:02 randolf-scholz

I believe we can consider dataclass_transform supported now

wesleywright avatar Mar 05 '23 17:03 wesleywright

For completeness' sake, here's the PEP 646 issue: https://github.com/python/mypy/issues/12280

jorenham avatar Mar 06 '23 00:03 jorenham

I don't think we need to keep this open. Almost everything is now implemented, and for couple remaining things we have dedicated issues.

ilevkivskyi avatar Oct 30 '23 20:10 ilevkivskyi