Skip to content

Commit 2524f19

Browse files
authored
Merge branch 'master' into default-strict-bytes
2 parents b6528b5 + e7f4619 commit 2524f19

1,029 files changed

Lines changed: 85775 additions & 26472 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/crash.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ labels: "crash"
1515

1616
**Traceback**
1717

18-
```
18+
```python-traceback
1919
(Insert traceback and other messages from mypy here -- use `--show-traceback`.)
2020
```
2121

@@ -25,6 +25,11 @@ labels: "crash"
2525
appreciated. We also very much appreciate it if you try to narrow the
2626
source down to a small stand-alone example.)
2727

28+
```python
29+
# Ideally, a small sample program that demonstrates the problem.
30+
# Or even better, a reproducible playground link https://mypy-play.net/ (use the "Gist" button)
31+
```
32+
2833
**Your Environment**
2934

3035
<!-- Include as many relevant details about the environment you experienced the bug in -->

.github/workflows/build_wheels.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ on:
66
tags: ['*']
77

88
permissions:
9-
contents: write
9+
contents: read
1010

1111
jobs:
1212
build-wheels:
1313
if: github.repository == 'python/mypy'
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
1719
- uses: actions/setup-python@v5
1820
with:
1921
python-version: '3.11'

.github/workflows/docs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
# so it's important to do the docs build on all PRs touching mypy/errorcodes.py
1313
# in case somebody's adding a new error code without any docs
1414
- 'mypy/errorcodes.py'
15+
# Part of the documentation is automatically generated from the options
16+
# definitions in mypy/main.py
17+
- 'mypy/main.py'
1518
- 'mypyc/doc/**'
1619
- '**/*.rst'
1720
- '**/*.md'
@@ -35,11 +38,13 @@ jobs:
3538
VERIFY_MYPY_ERROR_CODES: 1
3639
steps:
3740
- uses: actions/checkout@v4
41+
with:
42+
persist-credentials: false
3843
- uses: actions/setup-python@v5
3944
with:
4045
python-version: '3.12'
4146
- name: Install tox
42-
run: pip install tox==4.21.2
47+
run: pip install tox==4.26.0
4348
- name: Setup tox environment
4449
run: tox run -e ${{ env.TOXENV }} --notest
4550
- name: Test

.github/workflows/mypy_primer.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,20 @@ jobs:
2626
mypy_primer:
2727
name: Run mypy_primer
2828
runs-on: ubuntu-latest
29-
permissions:
30-
contents: read
3129
strategy:
3230
matrix:
33-
shard-index: [0, 1, 2, 3, 4]
31+
shard-index: [0, 1, 2, 3, 4, 5]
3432
fail-fast: false
3533
timeout-minutes: 60
3634
steps:
3735
- uses: actions/checkout@v4
3836
with:
3937
path: mypy_to_test
4038
fetch-depth: 0
39+
persist-credentials: false
4140
- uses: actions/setup-python@v5
4241
with:
43-
python-version: "3.12"
42+
python-version: "3.14"
4443
- name: Install dependencies
4544
run: |
4645
python -m pip install -U pip
@@ -64,10 +63,11 @@ jobs:
6463
mypy_primer \
6564
--repo mypy_to_test \
6665
--new $GITHUB_SHA --old base_commit \
67-
--num-shards 5 --shard-index ${{ matrix.shard-index }} \
66+
--num-shards 6 --shard-index ${{ matrix.shard-index }} \
6867
--debug \
6968
--additional-flags="--debug-serialize" \
7069
--output concise \
70+
--mypy-install-librt \
7171
| tee diff_${{ matrix.shard-index }}.txt
7272
) || [ $? -eq 1 ]
7373
- if: ${{ matrix.shard-index == 0 }}
@@ -93,8 +93,6 @@ jobs:
9393
name: Join artifacts
9494
runs-on: ubuntu-latest
9595
needs: [mypy_primer]
96-
permissions:
97-
contents: read
9896
steps:
9997
- name: Merge artifacts
10098
uses: actions/upload-artifact/merge@v4

.github/workflows/mypy_primer_comment.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
name: Comment with mypy_primer diff
22

3-
on:
3+
on: # zizmor: ignore[dangerous-triggers]
44
workflow_run:
55
workflows:
66
- Run mypy_primer
77
types:
88
- completed
99

10-
permissions:
11-
contents: read
12-
pull-requests: write
10+
permissions: {}
1311

1412
jobs:
1513
comment:
1614
name: Comment PR from mypy_primer
1715
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
pull-requests: write
1819
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1920
steps:
2021
- name: Download diffs

.github/workflows/sync_typeshed.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@ on:
55
schedule:
66
- cron: "0 0 1,15 * *"
77

8-
permissions:
9-
contents: write
10-
pull-requests: write
8+
permissions: {}
119

1210
jobs:
1311
sync_typeshed:
1412
name: Sync typeshed
1513
if: github.repository == 'python/mypy'
1614
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
1718
timeout-minutes: 10
1819
steps:
1920
- uses: actions/checkout@v4
2021
with:
2122
fetch-depth: 0
23+
persist-credentials: true # needed to `git push` the PR branch
2224
# TODO: use whatever solution ends up working for
2325
# https://github.com/python/typeshed/issues/8434
2426
- uses: actions/setup-python@v5

.github/workflows/test.yml

Lines changed: 62 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -31,82 +31,94 @@ jobs:
3131
include:
3232
# Make sure to run mypyc compiled unit tests for both
3333
# the oldest and newest supported Python versions
34-
- name: Test suite with py39-ubuntu, mypyc-compiled
35-
python: '3.9'
36-
arch: x64
37-
os: ubuntu-latest
34+
- name: Test suite with py310-ubuntu, mypyc-compiled
35+
python: '3.10'
36+
os: ubuntu-24.04-arm
3837
toxenv: py
3938
tox_extra_args: "-n 4"
4039
test_mypyc: true
41-
- name: Test suite with py39-windows-64
42-
python: '3.9'
43-
arch: x64
44-
os: windows-latest
45-
toxenv: py39
40+
- name: Test suite with py311-ubuntu
41+
python: '3.11'
42+
os: ubuntu-24.04-arm
43+
toxenv: py
4644
tox_extra_args: "-n 4"
47-
- name: Test suite with py310-ubuntu
48-
python: '3.10'
49-
arch: x64
50-
os: ubuntu-latest
45+
- name: Test suite with py312-ubuntu
46+
python: '3.12'
47+
os: ubuntu-24.04-arm
5148
toxenv: py
5249
tox_extra_args: "-n 4"
53-
- name: Test suite with py311-ubuntu, mypyc-compiled
54-
python: '3.11'
55-
arch: x64
56-
os: ubuntu-latest
50+
- name: Test suite with py313-ubuntu, mypyc-compiled
51+
python: '3.13'
52+
os: ubuntu-24.04-arm
5753
toxenv: py
5854
tox_extra_args: "-n 4"
5955
test_mypyc: true
60-
- name: Test suite with py312-ubuntu, mypyc-compiled
61-
python: '3.12'
62-
arch: x64
63-
os: ubuntu-latest
56+
- name: Test suite with py314-ubuntu, mypyc-compiled
57+
python: '3.14'
58+
os: ubuntu-24.04-arm
6459
toxenv: py
6560
tox_extra_args: "-n 4"
6661
test_mypyc: true
67-
- name: Test suite with py313-ubuntu, mypyc-compiled
68-
python: '3.13'
69-
arch: x64
70-
os: ubuntu-latest
62+
- name: Test suite with py314t-ubuntu, mypyc-compiled
63+
python: '3.14t'
64+
os: ubuntu-24.04-arm
7165
toxenv: py
7266
tox_extra_args: "-n 4"
7367
test_mypyc: true
68+
- name: Test suite with py314-windows-64
69+
python: '3.14'
70+
os: windows-latest
71+
toxenv: py
72+
tox_extra_args: "-n 4"
7473

75-
# - name: Test suite with py314-dev-ubuntu
76-
# python: '3.14-dev'
77-
# arch: x64
78-
# os: ubuntu-latest
74+
# - name: Test suite with py315-dev-ubuntu
75+
# python: '3.15-dev'
76+
# os: ubuntu-24.04-arm
7977
# toxenv: py
8078
# tox_extra_args: "-n 4"
81-
# allow_failure: true
79+
# # allow_failure: true
8280
# test_mypyc: true
8381

84-
- name: mypyc runtime tests with py39-macos
85-
python: '3.9.21'
86-
arch: x64
87-
# TODO: macos-13 is the last one to support Python 3.9, change it to macos-latest when updating the Python version
88-
os: macos-13
82+
- name: mypyc runtime tests with py313-macos
83+
python: '3.13'
84+
os: macos-latest
85+
toxenv: py
86+
tox_extra_args: "-n 3 mypyc/test/test_run.py mypyc/test/test_external.py"
87+
88+
- name: mypyc runtime tests with py310-ubuntu
89+
python: '3.10'
90+
os: ubuntu-latest
8991
toxenv: py
9092
tox_extra_args: "-n 3 mypyc/test/test_run.py mypyc/test/test_external.py"
93+
9194
# This is broken. See
9295
# - https://github.com/python/mypy/issues/17819
9396
# - https://github.com/python/mypy/pull/17822
9497
# - name: mypyc runtime tests with py38-debug-build-ubuntu
9598
# python: '3.9.21'
96-
# arch: x64
9799
# os: ubuntu-latest
98100
# toxenv: py
99101
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
100102
# debug_build: true
101103

102-
- name: Type check our own code (py39-ubuntu)
103-
python: '3.9'
104-
arch: x64
104+
- name: Parallel tests with py314-ubuntu, interpreted
105+
python: '3.14'
106+
os: ubuntu-24.04-arm
107+
toxenv: py
108+
tox_extra_args: "-n 4 --mypy-num-workers=4 mypy/test/testcheck.py"
109+
- name: Parallel tests with py314-ubuntu, mypyc-compiled
110+
python: '3.14'
111+
os: ubuntu-24.04-arm
112+
toxenv: py
113+
tox_extra_args: "-n 4 --mypy-num-workers=4 mypy/test/testcheck.py"
114+
test_mypyc: true
115+
116+
- name: Type check our own code (py310-ubuntu)
117+
python: '3.10'
105118
os: ubuntu-latest
106119
toxenv: type
107-
- name: Type check our own code (py39-windows-64)
108-
python: '3.9'
109-
arch: x64
120+
- name: Type check our own code (py310-windows-64)
121+
python: '3.10'
110122
os: windows-latest
111123
toxenv: type
112124

@@ -115,7 +127,6 @@ jobs:
115127
# to ensure the tox env works as expected
116128
- name: Formatting and code style with Black + ruff
117129
python: '3.10'
118-
arch: x64
119130
os: ubuntu-latest
120131
toxenv: lint
121132

@@ -127,6 +138,8 @@ jobs:
127138
FORCE_COLOR: ${{ !(startsWith(matrix.os, 'windows-') && startsWith(matrix.toxenv, 'py')) && 1 || 0 }}
128139
# Tox
129140
PY_COLORS: 1
141+
# Python -- Disable argparse help colors (3.14+)
142+
PYTHON_COLORS: 0
130143
# Mypy (see https://github.com/python/mypy/issues/7771)
131144
TERM: xterm-color
132145
MYPY_FORCE_COLOR: 1
@@ -136,6 +149,8 @@ jobs:
136149

137150
steps:
138151
- uses: actions/checkout@v4
152+
with:
153+
persist-credentials: false
139154

140155
- name: Debug build
141156
if: ${{ matrix.debug_build }}
@@ -167,7 +182,6 @@ jobs:
167182
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
168183
with:
169184
python-version: ${{ matrix.python }}
170-
architecture: ${{ matrix.arch }}
171185

172186
- name: Install tox
173187
run: |
@@ -178,7 +192,7 @@ jobs:
178192
echo debug build; python -c 'import sysconfig; print(bool(sysconfig.get_config_var("Py_DEBUG")))'
179193
echo os.cpu_count; python -c 'import os; print(os.cpu_count())'
180194
echo os.sched_getaffinity; python -c 'import os; print(len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
181-
pip install setuptools==75.1.0 tox==4.21.2
195+
pip install setuptools==75.1.0 tox==4.26.0
182196
183197
- name: Compiled with mypyc
184198
if: ${{ matrix.test_mypyc }}
@@ -217,6 +231,8 @@ jobs:
217231
CC: i686-linux-gnu-gcc
218232
steps:
219233
- uses: actions/checkout@v4
234+
with:
235+
persist-credentials: false
220236
- name: Install 32-bit build dependencies
221237
run: |
222238
sudo dpkg --add-architecture i386 && \
@@ -239,7 +255,7 @@ jobs:
239255
default: 3.11.1
240256
command: python -c "import platform; print(f'{platform.architecture()=} {platform.machine()=}');"
241257
- name: Install tox
242-
run: pip install setuptools==75.1.0 tox==4.21.2
258+
run: pip install setuptools==75.1.0 tox==4.26.0
243259
- name: Setup tox environment
244260
run: tox run -e py --notest
245261
- name: Test

.github/workflows/test_stubgenc.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- 'mypy/stubgenc.py'
1212
- 'mypy/stubdoc.py'
1313
- 'mypy/stubutil.py'
14-
- 'test-data/stubgen/**'
14+
- 'test-data/pybind11_fixtures/**'
1515

1616
permissions:
1717
contents: read
@@ -29,11 +29,13 @@ jobs:
2929
steps:
3030

3131
- uses: actions/checkout@v4
32+
with:
33+
persist-credentials: false
3234

33-
- name: Setup 🐍 3.9
35+
- name: Setup 🐍 3.10
3436
uses: actions/setup-python@v5
3537
with:
36-
python-version: 3.9
38+
python-version: '3.10'
3739

3840
- name: Test stubgenc
3941
run: misc/test-stubgenc.sh

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ venv/
1717
test-data/packages/.pip_lock
1818
dmypy.json
1919
.dmypy.json
20+
/.mypyc_test_output
2021

2122
# Packages
2223
*.egg

0 commit comments

Comments
 (0)