From cf63ccb0d682d5bc7d6af8c7f339f831d3ea0dcb Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Thu, 23 Apr 2026 11:55:46 +0100 Subject: [PATCH 1/2] Depend on ast-serialize by default, drop upper version bound This way parallel checking is available in the default install (as an experimental feature in mypy 2.0). We will keep ast-serialize backward compatible. By dropping the upper version bound, can avoid some minor friction when updating ast-serialize version to 1.x. Also `pip install mypy[native-parser]` is no longer supported, as it's redundant now. --- docs/source/common_issues.rst | 3 +-- mypy-requirements.txt | 1 + mypy/nativeparse.py | 4 ++-- pyproject.toml | 2 +- test-requirements.in | 1 - 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/source/common_issues.rst b/docs/source/common_issues.rst index 99060ff8bc1b2..e72e2c99d3c57 100644 --- a/docs/source/common_issues.rst +++ b/docs/source/common_issues.rst @@ -232,8 +232,7 @@ improved performance. You can ensure the presence of orjson using the ``faster-c python3 -m pip install -U mypy[faster-cache] -Mypy may depend on orjson by default in the future. To use faster, native parser, use the -``native-parse`` extra. Native parser will be default in near future. +Mypy may depend on orjson by default in the future. Types of empty collections -------------------------- diff --git a/mypy-requirements.txt b/mypy-requirements.txt index 19086e49393b7..e3271768a5c22 100644 --- a/mypy-requirements.txt +++ b/mypy-requirements.txt @@ -6,3 +6,4 @@ mypy_extensions>=1.0.0 pathspec>=1.0.0 tomli>=1.1.0; python_version<'3.11' librt>=0.9.0; platform_python_implementation != 'PyPy' +ast-serialize>=0.2.0 diff --git a/mypy/nativeparse.py b/mypy/nativeparse.py index f6c93d58b5d6e..6542fb3073c19 100644 --- a/mypy/nativeparse.py +++ b/mypy/nativeparse.py @@ -26,8 +26,8 @@ try: import ast_serialize # type: ignore[import-not-found, unused-ignore] except ImportError: - print("error: native parser not installed") - print("note: to install run `pip install mypy[native-parser]`") + print("error: ast-serialize package not installed") + print("note: to install run `pip install ast-serialize`") sys.exit(2) from librt.internal import ( diff --git a/pyproject.toml b/pyproject.toml index fcf65b599a125..4351694ec32c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,7 @@ dependencies = [ "pathspec>=1.0.0", "tomli>=1.1.0; python_version<'3.11'", "librt>=0.9.0; platform_python_implementation != 'PyPy'", + "ast-serialize>=0.2.0", ] dynamic = ["version"] @@ -65,7 +66,6 @@ mypyc = ["setuptools>=50"] reports = ["lxml"] install-types = ["pip"] faster-cache = ["orjson"] -native-parser = ["ast-serialize>=0.2.0,<1.0.0"] [project.urls] Homepage = "https://www.mypy-lang.org/" diff --git a/test-requirements.in b/test-requirements.in index 5b1729c9eb864..9cc276901f89e 100644 --- a/test-requirements.in +++ b/test-requirements.in @@ -13,4 +13,3 @@ pytest-cov>=2.10.0 setuptools>=77.0.3 tomli>=1.1.0 # needed even on py311+ so the self check passes with --python-version 3.10 pre_commit>=3.5.0 -ast-serialize>=0.2.0,<1.0.0 From f935f2b6c15f26e6d56ce1bf6beabe80a0281e22 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Thu, 23 Apr 2026 12:52:48 +0100 Subject: [PATCH 2/2] Address feedback --- mypy-requirements.txt | 2 +- pyproject.toml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mypy-requirements.txt b/mypy-requirements.txt index e3271768a5c22..d742fcf3c9980 100644 --- a/mypy-requirements.txt +++ b/mypy-requirements.txt @@ -6,4 +6,4 @@ mypy_extensions>=1.0.0 pathspec>=1.0.0 tomli>=1.1.0; python_version<'3.11' librt>=0.9.0; platform_python_implementation != 'PyPy' -ast-serialize>=0.2.0 +ast-serialize>=0.2.0,<1.0.0 diff --git a/pyproject.toml b/pyproject.toml index 4351694ec32c6..a509514933e3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,7 @@ dependencies = [ "pathspec>=1.0.0", "tomli>=1.1.0; python_version<'3.11'", "librt>=0.9.0; platform_python_implementation != 'PyPy'", - "ast-serialize>=0.2.0", + "ast-serialize>=0.2.0,<1.0.0", ] dynamic = ["version"] @@ -66,6 +66,7 @@ mypyc = ["setuptools>=50"] reports = ["lxml"] install-types = ["pip"] faster-cache = ["orjson"] +native-parser = [] [project.urls] Homepage = "https://www.mypy-lang.org/"