Skip to content

Commit 4929815

Browse files
committed
Merge branch 'master' into fix_union_inference_of_generic_class_and_its_generic_type
2 parents 133c49b + 0808624 commit 4929815

File tree

716 files changed

+25549
-8666
lines changed

Some content is hidden

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

716 files changed

+25549
-8666
lines changed

.github/workflows/build_wheels.yml

+3-1
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

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
VERIFY_MYPY_ERROR_CODES: 1
3636
steps:
3737
- uses: actions/checkout@v4
38+
with:
39+
persist-credentials: false
3840
- uses: actions/setup-python@v5
3941
with:
4042
python-version: '3.12'

.github/workflows/mypy_primer.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
mypy_primer:
2727
name: Run mypy_primer
2828
runs-on: ubuntu-latest
29-
permissions:
30-
contents: read
3129
strategy:
3230
matrix:
3331
shard-index: [0, 1, 2, 3, 4]
@@ -38,9 +36,10 @@ jobs:
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.13"
4443
- name: Install dependencies
4544
run: |
4645
python -m pip install -U pip
@@ -74,9 +73,9 @@ jobs:
7473
name: Save PR number
7574
run: |
7675
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
77-
- if: ${{ matrix.shard-index == 0 }}
78-
name: Upload mypy_primer diff + PR number
76+
- name: Upload mypy_primer diff + PR number
7977
uses: actions/upload-artifact@v4
78+
if: ${{ matrix.shard-index == 0 }}
8079
with:
8180
name: mypy_primer_diffs-${{ matrix.shard-index }}
8281
path: |
@@ -93,8 +92,6 @@ jobs:
9392
name: Join artifacts
9493
runs-on: ubuntu-latest
9594
needs: [mypy_primer]
96-
permissions:
97-
contents: read
9895
steps:
9996
- name: Merge artifacts
10097
uses: actions/upload-artifact/merge@v4

.github/workflows/mypy_primer_comment.yml

+6-5
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
@@ -48,7 +49,7 @@ jobs:
4849
with:
4950
github-token: ${{ secrets.GITHUB_TOKEN }}
5051
script: |
51-
const MAX_CHARACTERS = 30000
52+
const MAX_CHARACTERS = 50000
5253
const MAX_CHARACTERS_PER_PROJECT = MAX_CHARACTERS / 3
5354
5455
const fs = require('fs')

.github/workflows/sync_typeshed.yml

+5-3
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

+21-36
Original file line numberDiff line numberDiff line change
@@ -31,65 +31,51 @@ 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'
36-
arch: x64
37-
os: ubuntu-latest
34+
- name: Test suite with py39-ubuntu, mypyc-compiled
35+
python: '3.9'
36+
os: ubuntu-22.04-arm
3837
toxenv: py
3938
tox_extra_args: "-n 4"
4039
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 4"
47-
- name: Test suite with py39-ubuntu
40+
- name: Test suite with py39-windows-64
4841
python: '3.9'
49-
arch: x64
50-
os: ubuntu-latest
51-
toxenv: py
42+
os: windows-latest
43+
toxenv: py39
5244
tox_extra_args: "-n 4"
5345
- name: Test suite with py310-ubuntu
5446
python: '3.10'
55-
arch: x64
56-
os: ubuntu-latest
47+
os: ubuntu-22.04-arm
5748
toxenv: py
5849
tox_extra_args: "-n 4"
5950
- name: Test suite with py311-ubuntu, mypyc-compiled
6051
python: '3.11'
61-
arch: x64
62-
os: ubuntu-latest
52+
os: ubuntu-22.04-arm
6353
toxenv: py
6454
tox_extra_args: "-n 4"
6555
test_mypyc: true
6656
- name: Test suite with py312-ubuntu, mypyc-compiled
6757
python: '3.12'
68-
arch: x64
69-
os: ubuntu-latest
58+
os: ubuntu-22.04-arm
7059
toxenv: py
7160
tox_extra_args: "-n 4"
7261
test_mypyc: true
7362
- name: Test suite with py313-ubuntu, mypyc-compiled
7463
python: '3.13'
75-
arch: x64
76-
os: ubuntu-latest
64+
os: ubuntu-22.04-arm
7765
toxenv: py
7866
tox_extra_args: "-n 4"
7967
test_mypyc: true
8068

8169
# - name: Test suite with py314-dev-ubuntu
8270
# python: '3.14-dev'
83-
# arch: x64
84-
# os: ubuntu-latest
71+
# os: ubuntu-22.04-arm
8572
# toxenv: py
8673
# tox_extra_args: "-n 4"
8774
# allow_failure: true
8875
# test_mypyc: true
8976

9077
- name: mypyc runtime tests with py39-macos
91-
python: '3.9.18'
92-
arch: x64
78+
python: '3.9.21'
9379
# TODO: macos-13 is the last one to support Python 3.9, change it to macos-latest when updating the Python version
9480
os: macos-13
9581
toxenv: py
@@ -98,21 +84,18 @@ jobs:
9884
# - https://github.com/python/mypy/issues/17819
9985
# - https://github.com/python/mypy/pull/17822
10086
# - name: mypyc runtime tests with py38-debug-build-ubuntu
101-
# python: '3.8.17'
102-
# arch: x64
87+
# python: '3.9.21'
10388
# os: ubuntu-latest
10489
# toxenv: py
10590
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
10691
# debug_build: true
10792

108-
- name: Type check our own code (py38-ubuntu)
109-
python: '3.8'
110-
arch: x64
93+
- name: Type check our own code (py39-ubuntu)
94+
python: '3.9'
11195
os: ubuntu-latest
11296
toxenv: type
113-
- name: Type check our own code (py38-windows-64)
114-
python: '3.8'
115-
arch: x64
97+
- name: Type check our own code (py39-windows-64)
98+
python: '3.9'
11699
os: windows-latest
117100
toxenv: type
118101

@@ -121,7 +104,6 @@ jobs:
121104
# to ensure the tox env works as expected
122105
- name: Formatting and code style with Black + ruff
123106
python: '3.10'
124-
arch: x64
125107
os: ubuntu-latest
126108
toxenv: lint
127109

@@ -142,6 +124,8 @@ jobs:
142124

143125
steps:
144126
- uses: actions/checkout@v4
127+
with:
128+
persist-credentials: false
145129

146130
- name: Debug build
147131
if: ${{ matrix.debug_build }}
@@ -173,7 +157,6 @@ jobs:
173157
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
174158
with:
175159
python-version: ${{ matrix.python }}
176-
architecture: ${{ matrix.arch }}
177160

178161
- name: Install tox
179162
run: |
@@ -223,6 +206,8 @@ jobs:
223206
CC: i686-linux-gnu-gcc
224207
steps:
225208
- uses: actions/checkout@v4
209+
with:
210+
persist-credentials: false
226211
- name: Install 32-bit build dependencies
227212
run: |
228213
sudo dpkg --add-architecture i386 && \

.github/workflows/test_stubgenc.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ jobs:
2929
steps:
3030

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

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

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

.gitignore

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

.pre-commit-config.yaml

+48-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,64 @@
11
exclude: '^(mypyc/external/)|(mypy/typeshed/)|misc/typeshed_patches' # Exclude all vendored code from lints
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.5.0 # must match test-requirements.txt
4+
rev: v5.0.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.8.0 # must match test-requirements.txt
9+
rev: 25.1.0
1010
hooks:
1111
- id: black
1212
exclude: '^(test-data/)'
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.6.9 # must match test-requirements.txt
14+
rev: v0.8.6
1515
hooks:
1616
- id: ruff
1717
args: [--exit-non-zero-on-fix]
18+
- repo: https://github.com/python-jsonschema/check-jsonschema
19+
rev: 0.31.0
20+
hooks:
21+
- id: check-github-workflows
22+
- id: check-github-actions
23+
- id: check-readthedocs
24+
- repo: https://github.com/codespell-project/codespell
25+
rev: v2.4.1
26+
hooks:
27+
- id: codespell
28+
args:
29+
- --ignore-words-list=HAX,ccompiler,ot,statics,whet,zar
30+
exclude: ^(mypy/test/|mypy/typeshed/|mypyc/test-data/|test-data/).+$
31+
- repo: https://github.com/rhysd/actionlint
32+
rev: v1.7.7
33+
hooks:
34+
- id: actionlint
35+
args: [
36+
-ignore=property "debug_build" is not defined,
37+
-ignore=property "allow_failure" is not defined,
38+
-ignore=SC2(046|086),
39+
]
40+
additional_dependencies:
41+
# actionlint has a shellcheck integration which extracts shell scripts in `run:` steps from GitHub Actions
42+
# and checks these with shellcheck. This is arguably its most useful feature,
43+
# but the integration only works if shellcheck is installed
44+
- "github.com/wasilibs/go-shellcheck/cmd/[email protected]"
45+
- repo: https://github.com/woodruffw/zizmor-pre-commit
46+
rev: v1.0.1
47+
hooks:
48+
- id: zizmor
49+
- repo: local
50+
hooks:
51+
- id: bad-pr-link
52+
name: Bad PR link
53+
description: Detect PR links text that don't match their URL
54+
language: pygrep
55+
entry: '\[(\d+)\]\(https://github.com/python/mypy/pull/(?!\1/?\))\d+/?\)'
56+
files: CHANGELOG.md
57+
# Should be the last one:
58+
- repo: meta
59+
hooks:
60+
- id: check-hooks-apply
61+
- id: check-useless-excludes
62+
1863
ci:
1964
autoupdate_schedule: quarterly

0 commit comments

Comments
 (0)