Skip to content

Commit 401eb22

Browse files
committed
Merge branch 'master' into fix_union_inference_of_generic_class_and_its_generic_type
2 parents 2314852 + eb0575e commit 401eb22

File tree

526 files changed

+23994
-8879
lines changed

Some content is hidden

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

526 files changed

+23994
-8879
lines changed

.git-blame-ignore-revs

+4
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/workflows/docs.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ concurrency:
2828
jobs:
2929
docs:
3030
runs-on: ubuntu-latest
31+
timeout-minutes: 10
3132
env:
3233
TOXENV: docs
3334
TOX_SKIP_MISSING_INTERPRETERS: False
@@ -36,9 +37,9 @@ jobs:
3637
- uses: actions/checkout@v4
3738
- uses: actions/setup-python@v5
3839
with:
39-
python-version: '3.8'
40+
python-version: '3.12'
4041
- name: Install tox
41-
run: pip install --upgrade 'setuptools!=50' tox==4.11.0
42+
run: pip install tox==4.21.2
4243
- name: Setup tox environment
4344
run: tox run -e ${{ env.TOXENV }} --notest
4445
- name: Test

.github/workflows/mypy_primer.yml

+29-11
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:
3637
- uses: actions/checkout@v4
3738
with:
3839
path: mypy_to_test
3940
fetch-depth: 0
4041
- 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+
- if: ${{ matrix.shard-index == 0 }}
78+
name: Upload mypy_primer diff + PR number
79+
uses: actions/upload-artifact@v4
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

+1-1
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');

.github/workflows/sync_typeshed.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
name: Sync typeshed
1515
if: github.repository == 'python/mypy'
1616
runs-on: ubuntu-latest
17+
timeout-minutes: 10
1718
steps:
1819
- uses: actions/checkout@v4
1920
with:

.github/workflows/test.yml

+73-16
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,22 @@ jobs:
7070
toxenv: py
7171
tox_extra_args: "-n 4"
7272
test_mypyc: true
73+
- name: Test suite with py313-ubuntu, mypyc-compiled
74+
python: '3.13'
75+
arch: x64
76+
os: ubuntu-latest
77+
toxenv: py
78+
tox_extra_args: "-n 4"
79+
test_mypyc: true
80+
81+
# - name: Test suite with py314-dev-ubuntu
82+
# python: '3.14-dev'
83+
# arch: x64
84+
# os: ubuntu-latest
85+
# toxenv: py
86+
# tox_extra_args: "-n 4"
87+
# allow_failure: true
88+
# test_mypyc: true
7389

7490
- name: mypyc runtime tests with py39-macos
7591
python: '3.9.18'
@@ -78,13 +94,16 @@ jobs:
7894
os: macos-13
7995
toxenv: py
8096
tox_extra_args: "-n 3 mypyc/test/test_run.py mypyc/test/test_external.py"
81-
- name: mypyc runtime tests with py38-debug-build-ubuntu
82-
python: '3.8.17'
83-
arch: x64
84-
os: ubuntu-latest
85-
toxenv: py
86-
tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
87-
debug_build: true
97+
# This is broken. See
98+
# - https://github.com/python/mypy/issues/17819
99+
# - https://github.com/python/mypy/pull/17822
100+
# - name: mypyc runtime tests with py38-debug-build-ubuntu
101+
# python: '3.8.17'
102+
# arch: x64
103+
# os: ubuntu-latest
104+
# toxenv: py
105+
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
106+
# debug_build: true
88107

89108
- name: Type check our own code (py38-ubuntu)
90109
python: '3.8'
@@ -107,10 +126,11 @@ jobs:
107126
toxenv: lint
108127

109128
name: ${{ matrix.name }}
129+
timeout-minutes: 60
110130
env:
111131
TOX_SKIP_MISSING_INTERPRETERS: False
112-
# Rich (pip)
113-
FORCE_COLOR: 1
132+
# Rich (pip) -- Disable color for windows + pytest
133+
FORCE_COLOR: ${{ !(startsWith(matrix.os, 'windows-') && startsWith(matrix.toxenv, 'py')) && 1 || 0 }}
114134
# Tox
115135
PY_COLORS: 1
116136
# Mypy (see https://github.com/python/mypy/issues/7771)
@@ -119,37 +139,74 @@ jobs:
119139
MYPY_FORCE_TERMINAL_WIDTH: 200
120140
# Pytest
121141
PYTEST_ADDOPTS: --color=yes
142+
122143
steps:
123144
- uses: actions/checkout@v4
124-
- uses: actions/setup-python@v5
125-
with:
126-
python-version: ${{ matrix.python }}
127-
architecture: ${{ matrix.arch }}
145+
128146
- name: Debug build
129147
if: ${{ matrix.debug_build }}
130148
run: |
131149
PYTHONVERSION=${{ matrix.python }}
132150
PYTHONDIR=~/python-debug/python-$PYTHONVERSION
133151
VENV=$PYTHONDIR/env
134152
./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
153+
# TODO: does this do anything? env vars aren't passed to the next step right
135154
source $VENV/bin/activate
155+
- name: Latest dev build
156+
if: ${{ endsWith(matrix.python, '-dev') }}
157+
run: |
158+
git clone --depth 1 https://github.com/python/cpython.git /tmp/cpython --branch $( echo ${{ matrix.python }} | sed 's/-dev//' )
159+
cd /tmp/cpython
160+
echo git rev-parse HEAD; git rev-parse HEAD
161+
git show --no-patch
162+
sudo apt-get update
163+
sudo apt-get install -y --no-install-recommends \
164+
build-essential gdb lcov libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev \
165+
libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev
166+
./configure --prefix=/opt/pythondev
167+
make -j$(nproc)
168+
sudo make install
169+
sudo ln -s /opt/pythondev/bin/python3 /opt/pythondev/bin/python
170+
sudo ln -s /opt/pythondev/bin/pip3 /opt/pythondev/bin/pip
171+
echo "/opt/pythondev/bin" >> $GITHUB_PATH
172+
- uses: actions/setup-python@v5
173+
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
174+
with:
175+
python-version: ${{ matrix.python }}
176+
architecture: ${{ matrix.arch }}
177+
136178
- name: Install tox
137-
run: pip install setuptools==68.2.2 tox==4.11.0
179+
run: |
180+
echo PATH; echo $PATH
181+
echo which python; which python
182+
echo which pip; which pip
183+
echo python version; python -c 'import sys; print(sys.version)'
184+
echo debug build; python -c 'import sysconfig; print(bool(sysconfig.get_config_var("Py_DEBUG")))'
185+
echo os.cpu_count; python -c 'import os; print(os.cpu_count())'
186+
echo os.sched_getaffinity; python -c 'import os; print(len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
187+
pip install setuptools==75.1.0 tox==4.21.2
188+
138189
- name: Compiled with mypyc
139190
if: ${{ matrix.test_mypyc }}
140191
run: |
141192
pip install -r test-requirements.txt
142193
CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e .
194+
143195
- name: Setup tox environment
144196
run: |
145197
tox run -e ${{ matrix.toxenv }} --notest
146-
python -c 'import os; print("os.cpu_count", os.cpu_count(), "os.sched_getaffinity", len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
147198
- name: Test
148199
run: tox run -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }}
200+
continue-on-error: ${{ matrix.allow_failure == 'true' }}
201+
202+
- name: Mark as success (check failures manually)
203+
if: ${{ matrix.allow_failure == 'true' }}
204+
run: exit 0
149205

150206
python_32bits:
151207
runs-on: ubuntu-latest
152208
name: Test mypyc suite with 32-bit Python
209+
timeout-minutes: 60
153210
env:
154211
TOX_SKIP_MISSING_INTERPRETERS: False
155212
# Rich (pip)
@@ -188,7 +245,7 @@ jobs:
188245
default: 3.11.1
189246
command: python -c "import platform; print(f'{platform.architecture()=} {platform.machine()=}');"
190247
- name: Install tox
191-
run: pip install setuptools==68.2.2 tox==4.11.0
248+
run: pip install setuptools==75.1.0 tox==4.21.2
192249
- name: Setup tox environment
193250
run: tox run -e py --notest
194251
- name: Test

.github/workflows/test_stubgenc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
# Check stub file generation for a small pybind11 project
2626
# (full text match is required to pass)
2727
runs-on: ubuntu-latest
28+
timeout-minutes: 10
2829
steps:
2930

3031
- uses: actions/checkout@v4

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ repos:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.1.1 # must match test-requirements.txt
9+
rev: 24.8.0 # must match test-requirements.txt
1010
hooks:
1111
- id: black
1212
exclude: '^(test-data/)'
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.2.0 # must match test-requirements.txt
14+
rev: v0.6.9 # must match test-requirements.txt
1515
hooks:
1616
- id: ruff
1717
args: [--exit-non-zero-on-fix]

0 commit comments

Comments
 (0)