Closed
Description
Here's an issue for tracking the current state of mypy on CPython 3.10
CPython version: 3.10.0
mypy version: latest master (e6b91bd)
Dependencies:
- typed_ast is currently broken. Fixed on master, but no release to pypi yet (Allow compilation on python 3.10.0a6 typed_ast#155)
- typed_ast again broken in 3.10.0a7. PR Fix compilation on python 3.10.0a7 typed_ast#158
- lxml is currently broken due to a cython bug. The bug has been fixed in cython 0.29.22, but lxml hasn't been built with the new version yet (https://bugs.launchpad.net/lxml/+bug/1904900)
- virtualenv uses distutils, which is deprecated and will be removed in python 3.12. Mypy test-depends on
virtualenv<20
, and it looks like only virtualenv >=20 is still in active development. (Virtualenv pinned to <20 #10407) - pytest breaks on python 3.10. This is already fixed upstream, but mypy pins pytest to <6.2, because of python 3.5 support
Tests:
- Some tests from FineGrainedSuite, FineGrainedCacheSuite and PythonCmdlineSuite` are broken, because cpython parser error messages changed. (Fix a bunch of tests broken by python 3.10 #10404)
- Some occurrences of
error: invalid syntax
are nowerror: expected ':'
- Some occurrences of
error: unexpected EOF while parsing
are nowerror: '(' was never closed
- Some occurrences of
- Tests from SamplesSuite break with
mypy/typeshed/stdlib/types.pyi:334: error: Name '_NotImplementedType' is not defined
(Small fixes for Python 3.10 typeshed#5044) - Enable CI for python 3.10 (Enable CI to use Python 3.10 #11294)
Features
- Pattern matching
- Pattern matching is not yet supported (Support for python 3.10 match statement #10191)
- Exhaustiveness checking for pattern matching (Reachability/exhaustiveness checking for match statements #12010)
- Pattern matching in mypyc (Compiling code with
match
statements fails with an exception mypyc/mypyc#911)
- Support explicit TypeAlias (Support PEP 613 #9404)
- Support PEP 604 syntax for runtime use cases (Support PEP 604 syntax for runtime use cases #9880)
- PEP 604 for TypeVar bounds new union syntax (
types.Union
) doesn't work on generic bounds #10949
- PEP 604 for TypeVar bounds new union syntax (
- Support for dataclasses' kw_only ([dataclasses plugin] Support kw_only=True #10867)
- Support PEP 612 Parameter Specification Variables (PEP 612 tracking issue #8645)
Breaking changes
- mypyc is broken, because
_PyObject_HasAttrId
has been removed from CPython (bpo-41991: Remove _PyObject_HasAttrId cpython#22629). PR Fix mypyc failing to compile on CPython 3.10.0a6 #10202. - mypy/sitepkgs.py imports
distutils
, which is deprecated and will be removed in python 3.12 (Only import distutils if it is needed #10203).
Misc
- Build Python 3.10 wheels
- Add Python 3.10 classifier