Skip to content

Commit 3a96b8b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into improve-partial-None-error
2 parents c469567 + 38eb6e8 commit 3a96b8b

1,152 files changed

Lines changed: 62273 additions & 68384 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.

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
root = true
22

3-
[*.{py,c,cpp,h,rst,md,yml,json,test}]
3+
[*.{py,pyi,c,cpp,h,rst,md,yml,json,test}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
77

8-
[*.{py,c,h,json,test}]
8+
[*.{py,pyi,c,h,json,test}]
99
indent_size = 4
1010

1111
[*.yml]

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Adopt black and isort
2+
97c5ee99bc98dc475512e549b252b23a6e7e0997

.github/workflows/build_wheels.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
if: github.repository == 'python/mypy'
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-python@v2
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
1515
with:
1616
python-version: '3.7'
1717
- name: Trigger script

.github/workflows/docs.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Check documentation build
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [master, 'release*']
67
tags: ['*']
@@ -18,13 +19,14 @@ jobs:
1819
runs-on: ubuntu-latest
1920
env:
2021
TOXENV: docs
22+
TOX_SKIP_MISSING_INTERPRETERS: False
2123
steps:
22-
- uses: actions/checkout@v2
23-
- uses: actions/setup-python@v2
24+
- uses: actions/checkout@v3
25+
- uses: actions/setup-python@v4
2426
with:
25-
python-version: '3.10'
27+
python-version: '3.7'
2628
- name: Install tox
27-
run: pip install --upgrade 'setuptools!=50' 'virtualenv>=20.6.0' tox==3.24.5
29+
run: pip install --upgrade 'setuptools!=50' tox==3.24.5
2830
- name: Setup tox environment
2931
run: tox -e ${{ env.TOXENV }} --notest
3032
- name: Test

.github/workflows/mypy_primer.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ on:
77
- 'docs/**'
88
- '**/*.rst'
99
- '**/*.md'
10+
- 'misc/**'
1011
- 'mypyc/**'
1112
- 'mypy/stubtest.py'
1213
- 'mypy/stubgen.py'
1314
- 'mypy/stubgenc.py'
1415
- 'mypy/test/**'
16+
- 'test-data/**'
1517

1618
jobs:
1719
mypy_primer:
@@ -21,14 +23,14 @@ jobs:
2123
contents: read
2224
strategy:
2325
matrix:
24-
shard-index: [0, 1, 2]
26+
shard-index: [0, 1, 2, 3, 4]
2527
fail-fast: false
2628
steps:
27-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v3
2830
with:
2931
path: mypy_to_test
3032
fetch-depth: 0
31-
- uses: actions/setup-python@v2
33+
- uses: actions/setup-python@v4
3234
with:
3335
python-version: "3.10"
3436
- name: Install dependencies
@@ -54,13 +56,13 @@ jobs:
5456
mypy_primer \
5557
--repo mypy_to_test \
5658
--new $GITHUB_SHA --old base_commit \
57-
--num-shards 3 --shard-index ${{ matrix.shard-index }} \
59+
--num-shards 5 --shard-index ${{ matrix.shard-index }} \
5860
--debug \
5961
--output concise \
6062
| tee diff_${{ matrix.shard-index }}.txt
6163
) || [ $? -eq 1 ]
6264
- name: Upload mypy_primer diff
63-
uses: actions/upload-artifact@v2
65+
uses: actions/upload-artifact@v3
6466
with:
6567
name: mypy_primer_diffs
6668
path: diff_${{ matrix.shard-index }}.txt
@@ -70,7 +72,7 @@ jobs:
7072
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
7173
- if: ${{ matrix.shard-index }} == 0
7274
name: Upload PR number
73-
uses: actions/upload-artifact@v2
75+
uses: actions/upload-artifact@v3
7476
with:
7577
name: mypy_primer_diffs
7678
path: pr_number.txt

.github/workflows/mypy_primer_comment.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Download diffs
20-
uses: actions/github-script@v3
20+
uses: actions/github-script@v6
2121
with:
2222
script: |
2323
const fs = require('fs');
24-
const artifacts = await github.actions.listWorkflowRunArtifacts({
24+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
2525
owner: context.repo.owner,
2626
repo: context.repo.repo,
2727
run_id: ${{ github.event.workflow_run.id }},
2828
});
2929
const [matchArtifact] = artifacts.data.artifacts.filter((artifact) =>
3030
artifact.name == "mypy_primer_diffs");
3131
32-
const download = await github.actions.downloadArtifact({
32+
const download = await github.rest.actions.downloadArtifact({
3333
owner: context.repo.owner,
3434
repo: context.repo.repo,
3535
artifact_id: matchArtifact.id,
@@ -43,15 +43,17 @@ jobs:
4343
4444
- name: Post comment
4545
id: post-comment
46-
uses: actions/github-script@v3
46+
uses: actions/github-script@v6
4747
with:
4848
github-token: ${{ secrets.GITHUB_TOKEN }}
4949
script: |
5050
const fs = require('fs')
5151
let data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
5252
// posting comment fails if too long, so truncate
5353
if (data.length > 30000) {
54-
data = data.substring(0, 30000) + `\n\n... (truncated ${data.length - 30000} chars) ...\n`
54+
let truncated_data = data.substring(0, 30000)
55+
let lines_truncated = data.split('\n').length - truncated_data.split('\n').length
56+
data = truncated_data + `\n\n... (truncated ${lines_truncated} lines) ...\n`
5557
}
5658
5759
console.log("Diff from mypy_primer:")
@@ -64,7 +66,7 @@ jobs:
6466
body = 'According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉'
6567
}
6668
const prNumber = parseInt(fs.readFileSync("pr_number.txt", { encoding: "utf8" }))
67-
await github.issues.createComment({
69+
await github.rest.issues.createComment({
6870
issue_number: prNumber,
6971
owner: context.repo.owner,
7072
repo: context.repo.repo,

.github/workflows/test.yml

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Tests
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [master, 'release*']
67
tags: ['*']
@@ -14,6 +15,10 @@ on:
1415
- CREDITS
1516
- LICENSE
1617

18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
1722
jobs:
1823
main:
1924
runs-on: ${{ matrix.os }}
@@ -31,27 +36,27 @@ jobs:
3136
arch: x64
3237
os: windows-latest
3338
toxenv: py37
34-
- name: Test suite with py37-ubuntu
35-
python: '3.7'
39+
- name: Test suite with py38-ubuntu
40+
python: '3.8'
3641
arch: x64
3742
os: ubuntu-latest
3843
toxenv: py
3944
tox_extra_args: "-n 2"
40-
- name: Test suite with py38-ubuntu
41-
python: '3.8'
45+
- name: Test suite with py39-ubuntu
46+
python: '3.9'
4247
arch: x64
4348
os: ubuntu-latest
4449
toxenv: py
4550
tox_extra_args: "-n 2"
46-
- name: Test suite with py36-ubuntu, mypyc-compiled
47-
python: '3.6'
51+
- name: Test suite with py37-ubuntu, mypyc-compiled
52+
python: '3.7'
4853
arch: x64
4954
os: ubuntu-latest
5055
toxenv: py
5156
tox_extra_args: "-n 2"
5257
test_mypyc: true
53-
- name: Test suite with py39-ubuntu, mypyc-compiled
54-
python: '3.9'
58+
- name: Test suite with py310-ubuntu, mypyc-compiled
59+
python: '3.10'
5560
arch: x64
5661
os: ubuntu-latest
5762
toxenv: py
@@ -63,17 +68,17 @@ jobs:
6368
os: ubuntu-latest
6469
toxenv: py
6570
tox_extra_args: "-n 2"
66-
- name: mypyc runtime tests with py36-macos
67-
python: '3.6'
71+
- name: mypyc runtime tests with py37-macos
72+
python: '3.7'
6873
arch: x64
6974
os: macos-latest
7075
toxenv: py
7176
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
72-
- name: mypyc runtime tests with py36-debug-build-ubuntu
73-
python: '3.6.8'
77+
- name: mypyc runtime tests with py37-debug-build-ubuntu
78+
python: '3.7.13'
7479
arch: x64
7580
os: ubuntu-latest
76-
toxenv: py36
81+
toxenv: py
7782
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
7883
debug_build: true
7984
- name: Type check our own code (py37-ubuntu)
@@ -86,16 +91,18 @@ jobs:
8691
arch: x64
8792
os: windows-latest
8893
toxenv: type
89-
- name: Code style with flake8
94+
- name: Formatting with Black + isort and code style with flake8
9095
python: '3.7'
9196
arch: x64
9297
os: ubuntu-latest
9398
toxenv: lint
9499

95100
name: ${{ matrix.name }}
101+
env:
102+
TOX_SKIP_MISSING_INTERPRETERS: False
96103
steps:
97-
- uses: actions/checkout@v2
98-
- uses: actions/setup-python@v2
104+
- uses: actions/checkout@v3
105+
- uses: actions/setup-python@v4
99106
with:
100107
python-version: ${{ matrix.python }}
101108
architecture: ${{ matrix.arch }}
@@ -108,7 +115,7 @@ jobs:
108115
./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
109116
source $VENV/bin/activate
110117
- name: Install tox
111-
run: pip install --upgrade 'setuptools!=50' 'virtualenv>=20.6.0' tox==3.24.5
118+
run: pip install --upgrade 'setuptools!=50' tox==3.24.5
112119
- name: Compiled with mypyc
113120
if: ${{ matrix.test_mypyc }}
114121
run: |
@@ -119,23 +126,20 @@ jobs:
119126
- name: Test
120127
run: tox -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }}
121128

122-
# TODO: re-enable when `typed-ast` will be fixed for `python==3.11`
123-
# python-nightly:
124-
# runs-on: ubuntu-latest
125-
# name: Test suite with Python nightly
126-
# steps:
127-
# - uses: actions/checkout@v2
128-
# - uses: actions/setup-python@v2
129-
# with:
130-
# python-version: '3.11-dev'
131-
# - name: Install tox
132-
# run: |
133-
# pip install -U pip==21.2.3 setuptools
134-
# pip install --upgrade 'setuptools!=50' virtualenv==20.4.7 tox==3.20.1
135-
# - name: Setup tox environment
136-
# run: tox -e py --notest
137-
# - name: Test
138-
# run: tox -e py --skip-pkg-install -- "-n 2"
139-
# continue-on-error: true
140-
# - name: Mark as a success
141-
# run: exit 0
129+
python-nightly:
130+
runs-on: ubuntu-latest
131+
name: Test suite with Python nightly
132+
steps:
133+
- uses: actions/checkout@v3
134+
- uses: actions/setup-python@v4
135+
with:
136+
python-version: '3.11-dev'
137+
- name: Install tox
138+
run: pip install --upgrade 'setuptools!=50' tox==3.24.5
139+
- name: Setup tox environment
140+
run: tox -e py --notest
141+
- name: Test
142+
run: tox -e py --skip-pkg-install -- "-n 2"
143+
continue-on-error: true
144+
- name: Mark as a success
145+
run: exit 0

.github/workflows/test_stubgenc.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Test stubgenc on pybind11-mypy-demo
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [master, 'release*']
67
tags: ['*']
@@ -18,10 +19,10 @@ jobs:
1819
runs-on: ubuntu-latest
1920
steps:
2021

21-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v3
2223

2324
- name: Setup 🐍 3.8
24-
uses: actions/setup-python@v2
25+
uses: actions/setup-python@v4
2526
with:
2627
python-version: 3.8
2728

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ docs/source/_build
99
mypyc/doc/_build
1010
*.iml
1111
/out/
12-
.venv
12+
.venv*
1313
venv/
1414
.mypy_cache/
1515
.incremental_checker_cache.json
1616
.cache
17+
test-data/packages/.pip_lock
1718
dmypy.json
1819
.dmypy.json
1920

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 22.6.0 # must match test-requirements.txt
4+
hooks:
5+
- id: black
6+
- repo: https://github.com/pycqa/isort
7+
rev: 5.10.1 # must match test-requirements.txt
8+
hooks:
9+
- id: isort
10+
- repo: https://github.com/pycqa/flake8
11+
rev: 5.0.4 # must match test-requirements.txt
12+
hooks:
13+
- id: flake8
14+
additional_dependencies:
15+
- flake8-bugbear==22.8.23 # must match test-requirements.txt
16+
- flake8-noqa==1.2.9 # must match test-requirements.txt

0 commit comments

Comments
 (0)