Skip to content

Commit 2fcace1

Browse files
authored
Merge branch 'master' into issue-15553
2 parents a0308bc + e1d09d3 commit 2fcace1

File tree

939 files changed

+66839
-26431
lines changed

Some content is hidden

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

939 files changed

+66839
-26431
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/ISSUE_TEMPLATE/feature.md

+2-2
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

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ on:
55
branches: [main, master, 'release*']
66
tags: ['*']
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
build-wheels:
1013
if: github.repository == 'python/mypy'
1114
runs-on: ubuntu-latest
1215
steps:
13-
- uses: actions/checkout@v3
14-
- uses: actions/setup-python@v4
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
1518
with:
1619
python-version: '3.11'
1720
- name: Trigger script

.github/workflows/docs.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,23 @@ 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'
1418
- CREDITS
1519
- LICENSE
1620

21+
permissions:
22+
contents: read
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
26+
cancel-in-progress: true
27+
1728
jobs:
1829
docs:
1930
runs-on: ubuntu-latest
@@ -22,12 +33,12 @@ jobs:
2233
TOX_SKIP_MISSING_INTERPRETERS: False
2334
VERIFY_MYPY_ERROR_CODES: 1
2435
steps:
25-
- uses: actions/checkout@v3
26-
- uses: actions/setup-python@v4
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v5
2738
with:
28-
python-version: '3.8'
39+
python-version: '3.12'
2940
- name: Install tox
30-
run: pip install --upgrade 'setuptools!=50' tox==4.4.4
41+
run: pip install tox==4.21.2
3142
- name: Setup tox environment
3243
run: tox run -e ${{ env.TOXENV }} --notest
3344
- name: Test

.github/workflows/mypy_primer.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
- 'mypy/test/**'
1616
- 'test-data/**'
1717

18+
permissions:
19+
contents: read
20+
1821
concurrency:
1922
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2023
cancel-in-progress: true
@@ -30,13 +33,13 @@ jobs:
3033
shard-index: [0, 1, 2, 3, 4]
3134
fail-fast: false
3235
steps:
33-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3437
with:
3538
path: mypy_to_test
3639
fetch-depth: 0
37-
- uses: actions/setup-python@v4
40+
- uses: actions/setup-python@v5
3841
with:
39-
python-version: "3.10"
42+
python-version: "3.12"
4043
- name: Install dependencies
4144
run: |
4245
python -m pip install -U pip

.github/workflows/mypy_primer_comment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ 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: |

.github/workflows/sync_typeshed.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
if: github.repository == 'python/mypy'
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
2121
# TODO: use whatever solution ends up working for
2222
# https://github.com/python/typeshed/issues/8434
23-
- uses: actions/setup-python@v4
23+
- uses: actions/setup-python@v5
2424
with:
2525
python-version: "3.10"
2626
- name: git config

.github/workflows/test.yml

+93-43
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
- CREDITS
1616
- LICENSE
1717

18+
permissions:
19+
contents: read
20+
1821
concurrency:
1922
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2023
cancel-in-progress: true
@@ -33,47 +36,74 @@ jobs:
3336
arch: x64
3437
os: ubuntu-latest
3538
toxenv: py
36-
tox_extra_args: "-n 2"
39+
tox_extra_args: "-n 4"
3740
test_mypyc: true
3841
- name: Test suite with py38-windows-64
3942
python: '3.8'
4043
arch: x64
4144
os: windows-latest
4245
toxenv: py38
43-
tox_extra_args: "-n 2"
46+
tox_extra_args: "-n 4"
4447
- name: Test suite with py39-ubuntu
4548
python: '3.9'
4649
arch: x64
4750
os: ubuntu-latest
4851
toxenv: py
49-
tox_extra_args: "-n 2"
52+
tox_extra_args: "-n 4"
5053
- name: Test suite with py310-ubuntu
5154
python: '3.10'
5255
arch: x64
5356
os: ubuntu-latest
5457
toxenv: py
55-
tox_extra_args: "-n 2"
58+
tox_extra_args: "-n 4"
5659
- name: Test suite with py311-ubuntu, mypyc-compiled
5760
python: '3.11'
5861
arch: x64
5962
os: ubuntu-latest
6063
toxenv: py
61-
tox_extra_args: "-n 2"
64+
tox_extra_args: "-n 4"
6265
test_mypyc: true
63-
64-
- name: mypyc runtime tests with py38-macos
65-
python: '3.8.17'
66+
- name: Test suite with py312-ubuntu, mypyc-compiled
67+
python: '3.12'
6668
arch: x64
67-
os: macos-latest
69+
os: ubuntu-latest
6870
toxenv: py
69-
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
70-
- name: mypyc runtime tests with py38-debug-build-ubuntu
71-
python: '3.8.17'
71+
tox_extra_args: "-n 4"
72+
test_mypyc: true
73+
- name: Test suite with py313-ubuntu, mypyc-compiled
74+
python: '3.13'
7275
arch: x64
7376
os: ubuntu-latest
7477
toxenv: py
75-
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
76-
debug_build: true
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
89+
90+
- name: mypyc runtime tests with py39-macos
91+
python: '3.9.18'
92+
arch: x64
93+
# TODO: macos-13 is the last one to support Python 3.9, change it to macos-latest when updating the Python version
94+
os: macos-13
95+
toxenv: py
96+
tox_extra_args: "-n 3 mypyc/test/test_run.py mypyc/test/test_external.py"
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
77107

78108
- name: Type check our own code (py38-ubuntu)
79109
python: '3.8'
@@ -98,8 +128,8 @@ jobs:
98128
name: ${{ matrix.name }}
99129
env:
100130
TOX_SKIP_MISSING_INTERPRETERS: False
101-
# Rich (pip)
102-
FORCE_COLOR: 1
131+
# Rich (pip) -- Disable color for windows + pytest
132+
FORCE_COLOR: ${{ !(startsWith(matrix.os, 'windows-') && startsWith(matrix.toxenv, 'py')) && 1 || 0 }}
103133
# Tox
104134
PY_COLORS: 1
105135
# Mypy (see https://github.com/python/mypy/issues/7771)
@@ -108,49 +138,69 @@ jobs:
108138
MYPY_FORCE_TERMINAL_WIDTH: 200
109139
# Pytest
110140
PYTEST_ADDOPTS: --color=yes
141+
111142
steps:
112-
- uses: actions/checkout@v3
113-
- uses: actions/setup-python@v4
114-
with:
115-
python-version: ${{ matrix.python }}
116-
architecture: ${{ matrix.arch }}
143+
- uses: actions/checkout@v4
144+
117145
- name: Debug build
118146
if: ${{ matrix.debug_build }}
119147
run: |
120148
PYTHONVERSION=${{ matrix.python }}
121149
PYTHONDIR=~/python-debug/python-$PYTHONVERSION
122150
VENV=$PYTHONDIR/env
123151
./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
152+
# TODO: does this do anything? env vars aren't passed to the next step right
124153
source $VENV/bin/activate
154+
- name: Latest dev build
155+
if: ${{ endsWith(matrix.python, '-dev') }}
156+
run: |
157+
git clone --depth 1 https://github.com/python/cpython.git /tmp/cpython --branch $( echo ${{ matrix.python }} | sed 's/-dev//' )
158+
cd /tmp/cpython
159+
echo git rev-parse HEAD; git rev-parse HEAD
160+
git show --no-patch
161+
sudo apt-get update
162+
sudo apt-get install -y --no-install-recommends \
163+
build-essential gdb lcov libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev \
164+
libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev
165+
./configure --prefix=/opt/pythondev
166+
make -j$(nproc)
167+
sudo make install
168+
sudo ln -s /opt/pythondev/bin/python3 /opt/pythondev/bin/python
169+
sudo ln -s /opt/pythondev/bin/pip3 /opt/pythondev/bin/pip
170+
echo "/opt/pythondev/bin" >> $GITHUB_PATH
171+
- uses: actions/setup-python@v5
172+
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
173+
with:
174+
python-version: ${{ matrix.python }}
175+
architecture: ${{ matrix.arch }}
176+
125177
- name: Install tox
126-
run: pip install --upgrade 'setuptools!=50' tox==4.4.4
178+
run: |
179+
echo PATH; echo $PATH
180+
echo which python; which python
181+
echo which pip; which pip
182+
echo python version; python -c 'import sys; print(sys.version)'
183+
echo debug build; python -c 'import sysconfig; print(bool(sysconfig.get_config_var("Py_DEBUG")))'
184+
echo os.cpu_count; python -c 'import os; print(os.cpu_count())'
185+
echo os.sched_getaffinity; python -c 'import os; print(len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
186+
pip install setuptools==75.1.0 tox==4.21.2
187+
127188
- name: Compiled with mypyc
128189
if: ${{ matrix.test_mypyc }}
129190
run: |
130191
pip install -r test-requirements.txt
131192
CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e .
193+
132194
- name: Setup tox environment
133-
run: tox run -e ${{ matrix.toxenv }} --notest
195+
run: |
196+
tox run -e ${{ matrix.toxenv }} --notest
134197
- name: Test
135198
run: tox run -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }}
199+
continue-on-error: ${{ matrix.allow_failure == 'true' }}
136200

137-
python-nightly:
138-
runs-on: ubuntu-latest
139-
name: Test suite with Python nightly
140-
steps:
141-
- uses: actions/checkout@v3
142-
- uses: actions/setup-python@v4
143-
with:
144-
python-version: '3.12-dev'
145-
- name: Install tox
146-
run: pip install --upgrade 'setuptools!=50' tox==4.4.4
147-
- name: Setup tox environment
148-
run: tox run -e py --notest
149-
- name: Test
150-
run: tox run -e py --skip-pkg-install -- "-n 2"
151-
continue-on-error: true
152-
- name: Mark as a success
153-
run: exit 0
201+
- name: Mark as success (check failures manually)
202+
if: ${{ matrix.allow_failure == 'true' }}
203+
run: exit 0
154204

155205
python_32bits:
156206
runs-on: ubuntu-latest
@@ -170,7 +220,7 @@ jobs:
170220
CXX: i686-linux-gnu-g++
171221
CC: i686-linux-gnu-gcc
172222
steps:
173-
- uses: actions/checkout@v3
223+
- uses: actions/checkout@v4
174224
- name: Install 32-bit build dependencies
175225
run: |
176226
sudo dpkg --add-architecture i386 && \
@@ -193,8 +243,8 @@ jobs:
193243
default: 3.11.1
194244
command: python -c "import platform; print(f'{platform.architecture()=} {platform.machine()=}');"
195245
- name: Install tox
196-
run: pip install --upgrade 'setuptools!=50' tox==4.4.4
246+
run: pip install setuptools==75.1.0 tox==4.21.2
197247
- name: Setup tox environment
198248
run: tox run -e py --notest
199249
- name: Test
200-
run: tox run -e py --skip-pkg-install -- -n 2 mypyc/test/
250+
run: tox run -e py --skip-pkg-install -- -n 4 mypyc/test/

.github/workflows/test_stubgenc.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test stubgenc on pybind11-mypy-demo
1+
name: Test stubgenc on pybind11_fixtures
22

33
on:
44
workflow_dispatch:
@@ -10,19 +10,27 @@ on:
1010
- 'misc/test-stubgenc.sh'
1111
- 'mypy/stubgenc.py'
1212
- 'mypy/stubdoc.py'
13+
- 'mypy/stubutil.py'
1314
- 'test-data/stubgen/**'
1415

16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
1523
jobs:
1624
stubgenc:
1725
# Check stub file generation for a small pybind11 project
1826
# (full text match is required to pass)
1927
runs-on: ubuntu-latest
2028
steps:
2129

22-
- uses: actions/checkout@v3
30+
- uses: actions/checkout@v4
2331

2432
- name: Setup 🐍 3.8
25-
uses: actions/setup-python@v4
33+
uses: actions/setup-python@v5
2634
with:
2735
python-version: 3.8
2836

0 commit comments

Comments
 (0)