Skip to content

Commit 6bc17dc

Browse files
authored
Merge branch 'main' into set-narrowing
2 parents d5471c9 + 0149a15 commit 6bc17dc

File tree

2,986 files changed

+74727
-41091
lines changed

Some content is hidden

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

2,986 files changed

+74727
-41091
lines changed

.flake8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[flake8]
22
# NQA: Ruff won't warn about redundant `# noqa: Y`
33
# Y: Flake8 is only used to run flake8-pyi, everything else is in Ruff
4-
# F821: Until https://github.com/astral-sh/ruff/issues/3011 is fixed, we need flake8-pyi's monkeypatching
4+
# F821: Typeshed is a testing ground for flake8-pyi, which monkeypatches F821
55
select = NQA, Y, F821
66
# Ignore rules normally excluded by default
77
extend-ignore = Y090
@@ -13,7 +13,7 @@ per-file-ignores =
1313
# Y023: Alias typing as typing_extensions
1414
# Y026: Have implicit type aliases
1515
# Y053: have literals >50 characters long
16-
*_pb2.pyi: Y021, Y023, Y026, Y053
16+
stubs/*_pb2.pyi: Y021, Y023, Y026, Y053
1717

1818
exclude = .venv*,.git
1919
noqa_require_code = true

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* eol=lf
44
# Set linguist-language to support comments syntax highlight
55
**/stubtest_allowlist*.txt linguist-language=ini
6-
tests/stubtest_allowlists/*.txt linguist-language=ini
6+
**/stubtest_allowlists/*.txt linguist-language=ini
77
tests/pytype_exclude_list.txt linguist-language=ini
88
pyrightconfig*.json linguist-language=jsonc
99
.vscode/*.json linguist-language=jsonc

.github/renovate.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"dependencyDashboard": true,
44
"suppressNotifications": ["prEditedNotification"],
5-
"extends": ["config:base"],
5+
"extends": ["config:recommended"],
66
"labels": ["bot: dependencies"],
7+
"semanticCommits": "disabled",
8+
"separateMajorMinor": false,
9+
"prHourlyLimit": 10,
710
"pre-commit": {
811
"enabled": true
912
},
@@ -12,23 +15,20 @@
1215
"groupName": "GitHub Actions",
1316
"matchManagers": ["github-actions"],
1417
"description": "Quarterly update of GitHub Action dependencies",
15-
"separateMajorMinor": "false",
1618
"schedule": ["every 3 months on the first day of the month"]
1719
},
1820
{
1921
"groupName": "most test/lint dependencies",
2022
"matchManagers": ["pip_requirements", "pre-commit"],
2123
"excludePackageNames": ["pytype", "pyright"],
2224
"description": "Quarterly update of most test dependencies",
23-
"separateMajorMinor": "false",
2425
"schedule": ["every 3 months on the first day of the month"]
2526
},
2627
{
2728
"groupName": "pytype and pyright",
2829
"matchManagers": ["pip_requirements"],
2930
"matchPackageNames": ["pytype", "pyright"],
3031
"description": "Daily update of pyright and pytype",
31-
"separateMajorMinor": "false",
3232
"schedule": ["before 4am"]
3333
}
3434
]

.github/workflows/daily.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ jobs:
3434
runs-on: ${{ matrix.os }}
3535
strategy:
3636
matrix:
37-
# tkinter doesn't import on macOS-12
38-
os: ["ubuntu-latest", "windows-latest", "macos-11"]
39-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
37+
# As of 2024-10-18, ubuntu-latest can refer to different Ubuntu versions,
38+
# which can can cause problems with os module constants.
39+
os: ["ubuntu-24.04", "windows-latest", "macos-latest"]
40+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
4041
fail-fast: false
4142

4243
steps:
@@ -60,7 +61,9 @@ jobs:
6061
runs-on: ${{ matrix.os }}
6162
strategy:
6263
matrix:
63-
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
64+
# As of 2024-10-18, ubuntu-latest can refer to different Ubuntu versions,
65+
# which causes problems when testing gdb.
66+
os: ["ubuntu-24.04", "windows-latest", "macos-latest"]
6467
shard-index: [0, 1, 2, 3]
6568
fail-fast: false
6669
steps:
@@ -83,13 +86,13 @@ jobs:
8386
8487
if [ "${{ runner.os }}" = "Linux" ]; then
8588
if [ -n "$PACKAGES" ]; then
86-
sudo apt update && sudo apt install -y $PACKAGES
89+
sudo apt-get update && sudo apt-get install -y $PACKAGES
8790
fi
8891
8992
PYTHON_EXECUTABLE="xvfb-run python"
9093
else
9194
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
92-
brew install $PACKAGES
95+
brew install -q $PACKAGES
9396
fi
9497
9598
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
@@ -118,8 +121,7 @@ jobs:
118121
- uses: actions/setup-python@v5
119122
with:
120123
python-version: "3.12"
121-
- name: Install uv
122-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
124+
- uses: astral-sh/setup-uv@v5
123125
- name: Run tests
124126
run: |
125127
cd stub_uploader
@@ -131,18 +133,18 @@ jobs:
131133
name: Create an issue if daily tests failed
132134
runs-on: ubuntu-latest
133135
needs: [stubtest-stdlib, stubtest-third-party, stub-uploader]
134-
if: ${{ github.repository == 'python/typeshed' && always() && github.event_name != 'pull_request' && (needs.stubtest-stdlib.result == 'failure' || needs.stubtest-third-party.result == 'failure' || needs.stub-uploader.result == 'failure') }}
136+
if: ${{ github.repository == 'python/typeshed' && always() && github.event_name == 'schedule' && (needs.stubtest-stdlib.result == 'failure' || needs.stubtest-third-party.result == 'failure' || needs.stub-uploader.result == 'failure') }}
135137
permissions:
136138
issues: write
137139
steps:
138-
- uses: actions/github-script@v6
140+
- uses: actions/github-script@v7
139141
with:
140142
github-token: ${{ secrets.GITHUB_TOKEN }}
141143
script: |
142144
await github.rest.issues.create({
143145
owner: "python",
144146
repo: "typeshed",
145147
title: `Daily tests failed on ${new Date().toDateString()}`,
146-
body: "Runs listed here: https://github.com/python/typeshed/actions/workflows/daily.yml",
148+
body: "Run listed here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
147149
labels: ["help wanted"],
148150
})

.github/workflows/meta_tests.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
paths:
1111
- "scripts/**"
1212
- "tests/**"
13+
- "lib/**"
1314
- ".github/workflows/meta_tests.yml"
1415
- "requirements-tests.txt"
1516
- "pyproject.toml"
@@ -52,22 +53,15 @@ jobs:
5253
- uses: actions/checkout@v4
5354
- uses: actions/setup-python@v5
5455
with:
55-
# Max supported Python version as of pytype 2024.2.27.
56-
python-version: "3.11"
56+
python-version: "3.12"
5757
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
5858
- run: uv pip install -r requirements-tests.txt --system
59-
- name: Get pyright version
60-
id: pyright_version
61-
run: |
62-
PYRIGHT_VERSION=$(grep pyright== requirements-tests.txt | cut -d "#" -f 1 | cut -d \; -f 1 | cut -d = -f 3)
63-
echo pyright version: "${PYRIGHT_VERSION}"
64-
echo PYRIGHT_VERSION="${PYRIGHT_VERSION}" >> "${GITHUB_OUTPUT}"
6559
- name: Run pyright on typeshed
6660
uses: jakebailey/pyright-action@v2
6761
with:
68-
version: ${{ steps.pyright_version.outputs.PYRIGHT_VERSION }}
62+
version: PATH
6963
python-platform: ${{ matrix.python-platform }}
70-
python-version: "3.9" # The Python version to test against.
64+
python-version: "3.9" # Oldest version supported for running scripts and tests
7165
project: ./pyrightconfig.scripts_and_tests.json
7266
stubsabot-dry-run:
7367
name: Stubsabot dry run

.github/workflows/mypy_primer.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ jobs:
3131
fetch-depth: 0
3232
- uses: actions/setup-python@v5
3333
with:
34-
# TODO: As of 2024-03-08, confluent-kafka fails to install with
35-
# Python 3.12.
36-
python-version: "3.11"
34+
python-version: "3.13"
3735
- name: Install dependencies
3836
run: pip install git+https://github.com/hauntsaninja/mypy_primer.git
3937
- name: Run mypy_primer
@@ -59,18 +57,35 @@ jobs:
5957
--output concise \
6058
| tee diff_${{ matrix.shard-index }}.txt
6159
) || [ $? -eq 1 ]
62-
- name: Upload mypy_primer diff
63-
uses: actions/upload-artifact@v3
64-
with:
65-
name: mypy_primer_diffs
66-
path: diff_${{ matrix.shard-index }}.txt
67-
- if: ${{ matrix.shard-index }} == 0
60+
- if: ${{ matrix.shard-index == 0 }}
6861
name: Save PR number
6962
run: |
7063
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
71-
- if: ${{ matrix.shard-index }} == 0
72-
name: Upload PR number
73-
uses: actions/upload-artifact@v3
64+
- name: Upload mypy_primer diff + PR number
65+
uses: actions/upload-artifact@v4
66+
if: ${{ matrix.shard-index == 0 }}
67+
with:
68+
name: mypy_primer_diffs-${{ matrix.shard-index }}
69+
path: |
70+
diff_${{ matrix.shard-index }}.txt
71+
pr_number.txt
72+
- name: Upload mypy_primer diff
73+
uses: actions/upload-artifact@v4
74+
if: ${{ matrix.shard-index != 0 }}
75+
with:
76+
name: mypy_primer_diffs-${{ matrix.shard-index }}
77+
path: diff_${{ matrix.shard-index }}.txt
78+
79+
join_artifacts:
80+
name: Join artifacts
81+
runs-on: ubuntu-latest
82+
needs: [mypy_primer]
83+
permissions:
84+
contents: read
85+
steps:
86+
- name: Merge artifacts
87+
uses: actions/upload-artifact/merge@v4
7488
with:
7589
name: mypy_primer_diffs
76-
path: pr_number.txt
90+
pattern: mypy_primer_diffs-*
91+
delete-merged: true

.github/workflows/mypy_primer_comment.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Post mypy_primer comment
1+
name: Comment with mypy_primer diff
22

33
on:
44
workflow_run:
@@ -14,11 +14,11 @@ permissions:
1414
jobs:
1515
comment:
1616
name: Comment PR from mypy_primer
17-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1817
runs-on: ubuntu-latest
18+
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,9 +44,9 @@ jobs:
4444
4545
- name: Post comment
4646
id: post-comment
47-
uses: actions/github-script@v6
47+
uses: actions/github-script@v7
4848
with:
49-
github-token: ${{secrets.GITHUB_TOKEN}}
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
5050
script: |
5151
const fs = require('fs')
5252
let data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
@@ -59,6 +59,9 @@ jobs:
5959
data = truncated_data + `\n\n... (truncated ${lines_truncated} lines) ...\n`
6060
}
6161
62+
console.log("Diff from mypy_primer:")
63+
console.log(data)
64+
6265
let body
6366
if (data.trim()) {
6467
body = 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'

.github/workflows/stubsabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ jobs:
4444
needs: [stubsabot]
4545
if: ${{ github.repository == 'python/typeshed' && always() && (needs.stubsabot.result == 'failure') }}
4646
steps:
47-
- uses: actions/github-script@v6
47+
- uses: actions/github-script@v7
4848
with:
4949
github-token: ${{ secrets.GITHUB_TOKEN }}
5050
script: |
5151
await github.rest.issues.create({
5252
owner: "python",
5353
repo: "typeshed",
5454
title: `Stubsabot failed on ${new Date().toDateString()}`,
55-
body: "Stubsabot runs are listed here: https://github.com/python/typeshed/actions/workflows/stubsabot.yml",
55+
body: "Stubsabot run is listed here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
5656
})

.github/workflows/stubtest_stdlib.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ jobs:
3030
runs-on: ${{ matrix.os }}
3131
strategy:
3232
matrix:
33-
# tkinter doesn't import on macOS 12
34-
os: ["ubuntu-latest", "windows-latest", "macos-11"]
35-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
33+
# As of 2024-10-18, ubuntu-latest can refer to different Ubuntu versions,
34+
# which can can cause problems with os module constants.
35+
os: ["ubuntu-24.04", "windows-latest", "macos-latest"]
36+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
3637
fail-fast: false
3738

3839
steps:

.github/workflows/stubtest_third_party.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ jobs:
3232
runs-on: ${{ matrix.os }}
3333
strategy:
3434
matrix:
35-
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
35+
# As of 2024-10-18, ubuntu-latest can refer to different Ubuntu versions,
36+
# which causes problems when testing gdb.
37+
os: ["ubuntu-24.04", "windows-latest", "macos-latest"]
3638
fail-fast: false
3739

3840
steps:
@@ -69,14 +71,14 @@ jobs:
6971
if [ "${{ runner.os }}" = "Linux" ]; then
7072
if [ -n "$PACKAGES" ]; then
7173
echo "Installing apt packages: $PACKAGES"
72-
sudo apt update && sudo apt install -y $PACKAGES
74+
sudo apt-get update && sudo apt-get install -y $PACKAGES
7375
fi
7476
7577
PYTHON_EXECUTABLE="xvfb-run python"
7678
else
7779
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
7880
echo "Installing Homebrew packages: $PACKAGES"
79-
brew install $PACKAGES
81+
brew install -q $PACKAGES
8082
fi
8183
8284
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then

0 commit comments

Comments
 (0)