Skip to content

Commit 8ed2a51

Browse files
authored
Merge branch 'master' into callback-method
2 parents ab94945 + ee364ce commit 8ed2a51

File tree

1,148 files changed

+77762
-28722
lines changed

Some content is hidden

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

1,148 files changed

+77762
-28722
lines changed

.git-blame-ignore-revs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66
f98f78216ba9d6ab68c8e69c19e9f3c7926c5efe
77
# run pyupgrade (#12711)
88
fc335cb16315964b923eb1927e3aad1516891c28
9+
# update black to 23.3.0 (#15059)
10+
4276308be01ea498d946a79554b4a10b1cf13ccb
11+
# Update black to 24.1.1 (#16847)
12+
8107e53158d83d30bb04d290ac10d8d3ccd344f8

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ labels: "feature"
66

77
**Feature**
88

9-
(A clear and concise description of your feature proposal.)
9+
<!-- Enter a clear and concise description of your feature proposal here. -->
1010

1111
**Pitch**
1212

13-
(Please explain why this feature should be implemented and how it would be used. Add examples, if applicable.)
13+
<!-- Please explain why this feature should be implemented and how it would be used. Add examples, if applicable. -->

.github/workflows/build_wheels.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
if: github.repository == 'python/mypy'
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-python@v4
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
1818
with:
1919
python-version: '3.11'
2020
- name: Trigger script

.github/workflows/docs.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
pull_request:
99
paths:
1010
- 'docs/**'
11+
# We now have a docs check that fails if any error codes don't have documentation,
12+
# so it's important to do the docs build on all PRs touching mypy/errorcodes.py
13+
# in case somebody's adding a new error code without any docs
14+
- 'mypy/errorcodes.py'
1115
- 'mypyc/doc/**'
1216
- '**/*.rst'
1317
- '**/*.md'
@@ -24,17 +28,18 @@ concurrency:
2428
jobs:
2529
docs:
2630
runs-on: ubuntu-latest
31+
timeout-minutes: 10
2732
env:
2833
TOXENV: docs
2934
TOX_SKIP_MISSING_INTERPRETERS: False
3035
VERIFY_MYPY_ERROR_CODES: 1
3136
steps:
32-
- uses: actions/checkout@v3
33-
- uses: actions/setup-python@v4
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-python@v5
3439
with:
35-
python-version: '3.8'
40+
python-version: '3.12'
3641
- name: Install tox
37-
run: pip install --upgrade 'setuptools!=50' tox==4.11.0
42+
run: pip install tox==4.21.2
3843
- name: Setup tox environment
3944
run: tox run -e ${{ env.TOXENV }} --notest
4045
- name: Test

.github/workflows/mypy_primer.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ jobs:
3232
matrix:
3333
shard-index: [0, 1, 2, 3, 4]
3434
fail-fast: false
35+
timeout-minutes: 60
3536
steps:
36-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3738
with:
3839
path: mypy_to_test
3940
fetch-depth: 0
40-
- uses: actions/setup-python@v4
41+
- uses: actions/setup-python@v5
4142
with:
42-
python-version: "3.10"
43+
python-version: "3.12"
4344
- name: Install dependencies
4445
run: |
4546
python -m pip install -U pip
@@ -69,18 +70,35 @@ jobs:
6970
--output concise \
7071
| tee diff_${{ matrix.shard-index }}.txt
7172
) || [ $? -eq 1 ]
72-
- name: Upload mypy_primer diff
73-
uses: actions/upload-artifact@v3
74-
with:
75-
name: mypy_primer_diffs
76-
path: diff_${{ matrix.shard-index }}.txt
77-
- if: ${{ matrix.shard-index }} == 0
73+
- if: ${{ matrix.shard-index == 0 }}
7874
name: Save PR number
7975
run: |
8076
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
81-
- if: ${{ matrix.shard-index }} == 0
82-
name: Upload PR number
83-
uses: actions/upload-artifact@v3
77+
- name: Upload mypy_primer diff + PR number
78+
uses: actions/upload-artifact@v4
79+
if: ${{ matrix.shard-index == 0 }}
80+
with:
81+
name: mypy_primer_diffs-${{ matrix.shard-index }}
82+
path: |
83+
diff_${{ matrix.shard-index }}.txt
84+
pr_number.txt
85+
- name: Upload mypy_primer diff
86+
uses: actions/upload-artifact@v4
87+
if: ${{ matrix.shard-index != 0 }}
88+
with:
89+
name: mypy_primer_diffs-${{ matrix.shard-index }}
90+
path: diff_${{ matrix.shard-index }}.txt
91+
92+
join_artifacts:
93+
name: Join artifacts
94+
runs-on: ubuntu-latest
95+
needs: [mypy_primer]
96+
permissions:
97+
contents: read
98+
steps:
99+
- name: Merge artifacts
100+
uses: actions/upload-artifact/merge@v4
84101
with:
85102
name: mypy_primer_diffs
86-
path: pr_number.txt
103+
pattern: mypy_primer_diffs-*
104+
delete-merged: true

.github/workflows/mypy_primer_comment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1919
steps:
2020
- name: Download diffs
21-
uses: actions/github-script@v6
21+
uses: actions/github-script@v7
2222
with:
2323
script: |
2424
const fs = require('fs');
@@ -44,11 +44,11 @@ jobs:
4444
4545
- name: Post comment
4646
id: post-comment
47-
uses: actions/github-script@v6
47+
uses: actions/github-script@v7
4848
with:
4949
github-token: ${{ secrets.GITHUB_TOKEN }}
5050
script: |
51-
const MAX_CHARACTERS = 30000
51+
const MAX_CHARACTERS = 50000
5252
const MAX_CHARACTERS_PER_PROJECT = MAX_CHARACTERS / 3
5353
5454
const fs = require('fs')

.github/workflows/sync_typeshed.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ jobs:
1414
name: Sync typeshed
1515
if: github.repository == 'python/mypy'
1616
runs-on: ubuntu-latest
17+
timeout-minutes: 10
1718
steps:
18-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
1920
with:
2021
fetch-depth: 0
2122
# TODO: use whatever solution ends up working for
2223
# https://github.com/python/typeshed/issues/8434
23-
- uses: actions/setup-python@v4
24+
- uses: actions/setup-python@v5
2425
with:
2526
python-version: "3.10"
2627
- name: git config

.github/workflows/test.yml

Lines changed: 97 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -31,67 +31,81 @@ 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 py38-ubuntu, mypyc-compiled
35-
python: '3.8'
34+
- name: Test suite with py39-ubuntu, mypyc-compiled
35+
python: '3.9'
3636
arch: x64
3737
os: ubuntu-latest
3838
toxenv: py
39-
tox_extra_args: "-n 2"
39+
tox_extra_args: "-n 4"
4040
test_mypyc: true
41-
- name: Test suite with py38-windows-64
42-
python: '3.8'
43-
arch: x64
44-
os: windows-latest
45-
toxenv: py38
46-
tox_extra_args: "-n 2"
47-
- name: Test suite with py39-ubuntu
41+
- name: Test suite with py39-windows-64
4842
python: '3.9'
4943
arch: x64
50-
os: ubuntu-latest
51-
toxenv: py
52-
tox_extra_args: "-n 2"
44+
os: windows-latest
45+
toxenv: py39
46+
tox_extra_args: "-n 4"
5347
- name: Test suite with py310-ubuntu
5448
python: '3.10'
5549
arch: x64
5650
os: ubuntu-latest
5751
toxenv: py
58-
tox_extra_args: "-n 2"
52+
tox_extra_args: "-n 4"
5953
- name: Test suite with py311-ubuntu, mypyc-compiled
6054
python: '3.11'
6155
arch: x64
6256
os: ubuntu-latest
6357
toxenv: py
64-
tox_extra_args: "-n 2"
58+
tox_extra_args: "-n 4"
6559
test_mypyc: true
6660
- name: Test suite with py312-ubuntu, mypyc-compiled
67-
python: '3.12-dev'
61+
python: '3.12'
6862
arch: x64
6963
os: ubuntu-latest
7064
toxenv: py
71-
tox_extra_args: "-n 2"
65+
tox_extra_args: "-n 4"
7266
test_mypyc: true
73-
74-
- name: mypyc runtime tests with py38-macos
75-
python: '3.8.17'
67+
- name: Test suite with py313-ubuntu, mypyc-compiled
68+
python: '3.13'
7669
arch: x64
77-
os: macos-latest
70+
os: ubuntu-latest
7871
toxenv: py
79-
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
80-
- name: mypyc runtime tests with py38-debug-build-ubuntu
81-
python: '3.8.17'
72+
tox_extra_args: "-n 4"
73+
test_mypyc: true
74+
75+
# - name: Test suite with py314-dev-ubuntu
76+
# python: '3.14-dev'
77+
# arch: x64
78+
# os: ubuntu-latest
79+
# toxenv: py
80+
# tox_extra_args: "-n 4"
81+
# allow_failure: true
82+
# test_mypyc: true
83+
84+
- name: mypyc runtime tests with py39-macos
85+
python: '3.9.21'
8286
arch: x64
83-
os: ubuntu-latest
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
8489
toxenv: py
85-
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
86-
debug_build: true
90+
tox_extra_args: "-n 3 mypyc/test/test_run.py mypyc/test/test_external.py"
91+
# This is broken. See
92+
# - https://github.com/python/mypy/issues/17819
93+
# - https://github.com/python/mypy/pull/17822
94+
# - name: mypyc runtime tests with py38-debug-build-ubuntu
95+
# python: '3.9.21'
96+
# arch: x64
97+
# os: ubuntu-latest
98+
# toxenv: py
99+
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
100+
# debug_build: true
87101

88-
- name: Type check our own code (py38-ubuntu)
89-
python: '3.8'
102+
- name: Type check our own code (py39-ubuntu)
103+
python: '3.9'
90104
arch: x64
91105
os: ubuntu-latest
92106
toxenv: type
93-
- name: Type check our own code (py38-windows-64)
94-
python: '3.8'
107+
- name: Type check our own code (py39-windows-64)
108+
python: '3.9'
95109
arch: x64
96110
os: windows-latest
97111
toxenv: type
@@ -106,10 +120,11 @@ jobs:
106120
toxenv: lint
107121

108122
name: ${{ matrix.name }}
123+
timeout-minutes: 60
109124
env:
110125
TOX_SKIP_MISSING_INTERPRETERS: False
111-
# Rich (pip)
112-
FORCE_COLOR: 1
126+
# Rich (pip) -- Disable color for windows + pytest
127+
FORCE_COLOR: ${{ !(startsWith(matrix.os, 'windows-') && startsWith(matrix.toxenv, 'py')) && 1 || 0 }}
113128
# Tox
114129
PY_COLORS: 1
115130
# Mypy (see https://github.com/python/mypy/issues/7771)
@@ -118,35 +133,74 @@ jobs:
118133
MYPY_FORCE_TERMINAL_WIDTH: 200
119134
# Pytest
120135
PYTEST_ADDOPTS: --color=yes
136+
121137
steps:
122-
- uses: actions/checkout@v3
123-
- uses: actions/setup-python@v4
124-
with:
125-
python-version: ${{ matrix.python }}
126-
architecture: ${{ matrix.arch }}
138+
- uses: actions/checkout@v4
139+
127140
- name: Debug build
128141
if: ${{ matrix.debug_build }}
129142
run: |
130143
PYTHONVERSION=${{ matrix.python }}
131144
PYTHONDIR=~/python-debug/python-$PYTHONVERSION
132145
VENV=$PYTHONDIR/env
133146
./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
147+
# TODO: does this do anything? env vars aren't passed to the next step right
134148
source $VENV/bin/activate
149+
- name: Latest dev build
150+
if: ${{ endsWith(matrix.python, '-dev') }}
151+
run: |
152+
git clone --depth 1 https://github.com/python/cpython.git /tmp/cpython --branch $( echo ${{ matrix.python }} | sed 's/-dev//' )
153+
cd /tmp/cpython
154+
echo git rev-parse HEAD; git rev-parse HEAD
155+
git show --no-patch
156+
sudo apt-get update
157+
sudo apt-get install -y --no-install-recommends \
158+
build-essential gdb lcov libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev \
159+
libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev
160+
./configure --prefix=/opt/pythondev
161+
make -j$(nproc)
162+
sudo make install
163+
sudo ln -s /opt/pythondev/bin/python3 /opt/pythondev/bin/python
164+
sudo ln -s /opt/pythondev/bin/pip3 /opt/pythondev/bin/pip
165+
echo "/opt/pythondev/bin" >> $GITHUB_PATH
166+
- uses: actions/setup-python@v5
167+
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
168+
with:
169+
python-version: ${{ matrix.python }}
170+
architecture: ${{ matrix.arch }}
171+
135172
- name: Install tox
136-
run: pip install --upgrade 'setuptools!=50' tox==4.11.0
173+
run: |
174+
echo PATH; echo $PATH
175+
echo which python; which python
176+
echo which pip; which pip
177+
echo python version; python -c 'import sys; print(sys.version)'
178+
echo debug build; python -c 'import sysconfig; print(bool(sysconfig.get_config_var("Py_DEBUG")))'
179+
echo os.cpu_count; python -c 'import os; print(os.cpu_count())'
180+
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
182+
137183
- name: Compiled with mypyc
138184
if: ${{ matrix.test_mypyc }}
139185
run: |
140186
pip install -r test-requirements.txt
141187
CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e .
188+
142189
- name: Setup tox environment
143-
run: tox run -e ${{ matrix.toxenv }} --notest
190+
run: |
191+
tox run -e ${{ matrix.toxenv }} --notest
144192
- name: Test
145193
run: tox run -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }}
194+
continue-on-error: ${{ matrix.allow_failure == 'true' }}
195+
196+
- name: Mark as success (check failures manually)
197+
if: ${{ matrix.allow_failure == 'true' }}
198+
run: exit 0
146199

147200
python_32bits:
148201
runs-on: ubuntu-latest
149202
name: Test mypyc suite with 32-bit Python
203+
timeout-minutes: 60
150204
env:
151205
TOX_SKIP_MISSING_INTERPRETERS: False
152206
# Rich (pip)
@@ -162,7 +216,7 @@ jobs:
162216
CXX: i686-linux-gnu-g++
163217
CC: i686-linux-gnu-gcc
164218
steps:
165-
- uses: actions/checkout@v3
219+
- uses: actions/checkout@v4
166220
- name: Install 32-bit build dependencies
167221
run: |
168222
sudo dpkg --add-architecture i386 && \
@@ -185,8 +239,8 @@ jobs:
185239
default: 3.11.1
186240
command: python -c "import platform; print(f'{platform.architecture()=} {platform.machine()=}');"
187241
- name: Install tox
188-
run: pip install --upgrade 'setuptools!=50' tox==4.11.0
242+
run: pip install setuptools==75.1.0 tox==4.21.2
189243
- name: Setup tox environment
190244
run: tox run -e py --notest
191245
- name: Test
192-
run: tox run -e py --skip-pkg-install -- -n 2 mypyc/test/
246+
run: tox run -e py --skip-pkg-install -- -n 4 mypyc/test/

0 commit comments

Comments
 (0)