Skip to content

Commit 40ffeda

Browse files
authored
Add ast-serialize as an optional dependency (#21028)
A skipped test in `check-overloads.test` seems to be caused by a recent change in `ast_serialize`. FWIW it looks like a bug in the old parser? Leaving the test up to @JukkaL
1 parent 0352178 commit 40ffeda

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,17 @@ jobs:
106106
os: ubuntu-24.04-arm
107107
toxenv: py
108108
tox_extra_args: "-n 4 --mypy-num-workers=4 mypy/test/testcheck.py"
109-
dev_ast_serialize: true
110109
- name: Parallel tests with py314-ubuntu, mypyc-compiled
111110
python: '3.14'
112111
os: ubuntu-24.04-arm
113112
toxenv: py
114113
tox_extra_args: "-n 4 --mypy-num-workers=4 mypy/test/testcheck.py"
115114
test_mypyc: true
116-
dev_ast_serialize: true
117115
- name: Parallel tests with py314-windows-64, interpreted
118116
python: '3.14'
119117
os: windows-latest
120118
toxenv: py
121119
tox_extra_args: "-n 2 --mypy-num-workers=2 mypy/test/testcheck.py -k 'incremental or modules or classes'"
122-
dev_ast_serialize: true
123120

124121
- name: Type check our own code (py310-ubuntu)
125122
python: '3.10'
@@ -142,7 +139,6 @@ jobs:
142139
timeout-minutes: 60
143140
env:
144141
TOX_SKIP_MISSING_INTERPRETERS: False
145-
VIRTUALENV_SYSTEM_SITE_PACKAGES: ${{ matrix.dev_ast_serialize && 1 || 0 }}
146142
# Rich (pip) -- Disable color for windows + pytest
147143
FORCE_COLOR: ${{ !(startsWith(matrix.os, 'windows-') && startsWith(matrix.toxenv, 'py')) && 1 || 0 }}
148144
# Tox
@@ -217,11 +213,6 @@ jobs:
217213
pip install -r test-requirements.txt
218214
CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e .
219215
220-
# To speed-up process until ast_serialize is on PyPI.
221-
- name: Install pinned ast-serialize
222-
if: ${{ matrix.dev_ast_serialize }}
223-
run: pip install ast-serialize@git+https://github.com/mypyc/ast_serialize.git@052c5bfa3b2a5bf07c0b163ccbe2c5ccbfae9ac5
224-
225216
- name: Setup tox environment
226217
run: |
227218
tox run -e ${{ matrix.toxenv }} --notest

docs/source/common_issues.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,12 @@ make cold mypy runs several times faster.
228228

229229
Furthermore: as of `mypy 1.13 <https://mypy-lang.blogspot.com/2024/10/mypy-113-released.html>`_,
230230
mypy allows use of the orjson library for handling the cache instead of the stdlib json, for
231-
improved performance. You can ensure the presence of orjson using the faster-cache extra:
231+
improved performance. You can ensure the presence of orjson using the ``faster-cache`` extra:
232232

233233
python3 -m pip install -U mypy[faster-cache]
234234

235-
Mypy may depend on orjson by default in the future.
235+
Mypy may depend on orjson by default in the future. To use faster, native parser, use the
236+
``native-parse`` extra. Native parser will be default in near future.
236237

237238
Types of empty collections
238239
--------------------------

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ python2 = []
6464
reports = ["lxml"]
6565
install-types = ["pip"]
6666
faster-cache = ["orjson"]
67+
native-parse = ["ast-serialize>=0.1.1,<1.0.0"]
6768

6869
[project.urls]
6970
Homepage = "https://www.mypy-lang.org/"

test-data/unit/check-overloading.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6165,7 +6165,7 @@ reveal_type(f3(A())) # E: No overload variant of "f3" matches argument type "A"
61656165
# N: Revealed type is "Any"
61666166
reveal_type(f3(B())) # N: Revealed type is "__main__.B"
61676167

6168-
[case testOverloadIfSplitFunctionDef]
6168+
[case testOverloadIfSplitFunctionDef_no_native_parse]
61696169
# flags: --always-true True --always-false False
61706170
from typing import overload
61716171

test-requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ pytest-cov>=2.10.0
1313
setuptools>=77.0.3
1414
tomli>=1.1.0 # needed even on py311+ so the self check passes with --python-version 3.10
1515
pre_commit>=3.5.0
16+
ast-serialize>=0.1.1,<1.0.0

test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#
55
# pip-compile --allow-unsafe --output-file=test-requirements.txt --strip-extras test-requirements.in
66
#
7+
ast-serialize==0.1.1
8+
# via -r test-requirements.in
79
attrs==25.4.0
810
# via -r test-requirements.in
911
cfgv==3.4.0

0 commit comments

Comments
 (0)