Skip to content

Commit 26c206a

Browse files
authored
Merge branch 'main' into patch-4
2 parents 1bebecf + aa52024 commit 26c206a

File tree

5,188 files changed

+162552
-91897
lines changed

Some content is hidden

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

5,188 files changed

+162552
-91897
lines changed

.flake8

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,14 @@
1-
# The following rules come from plugins that are not used by typeshed.
2-
# Since typeshed stubs them, they can still be expected to be found in a
3-
# developer's venv for intellisense and reference reasons
4-
# A flake8-builtins
5-
# D flake8-docstrings
6-
# N8 pep8-naming
7-
# SIM flake8-simplify
8-
# RST flake8-rst-docstrings
9-
# TYP flake8-typing-imports
10-
11-
# The following rules are incompatible with or enforced by Black:
12-
# E203 whitespace before ':' -- scripts only
13-
# E301 expected 1 blank line
14-
# E302 expected 2 blank lines
15-
# E305 expected 2 blank lines
16-
# E501 line too long
17-
# E701 Multiple statements on one line (colon) -- disallows "..." on the same line
18-
19-
# Some rules are considered irrelevant to stub files:
20-
# B All flake8-bugbear rules are .py-specific
21-
# F401 imported but unused -- does not recognize re-exports
22-
# https://github.com/PyCQA/pyflakes/issues/474
23-
24-
# Rules that are out of the control of stub authors:
25-
# E741 ambiguous variable name
26-
# F403 import *' used; unable to detect undefined names
27-
# F405 defined from star imports
28-
291
[flake8]
30-
extend-ignore = A, D, N8, SIM, RST, TYP, E301, E302, E305, E501, E701
2+
# Y: Flake8 is only used to run flake8-pyi, everything else is in Ruff
3+
select = Y
4+
# Ignore rules normally excluded by default
5+
extend-ignore = Y090,Y091
316
per-file-ignores =
32-
*.py: E203
33-
*.pyi: B, E741, F401, F403, F405
34-
# Since typing.pyi defines "overload" this is not recognized by Flake8 as typing.overload.
35-
# Unfortunately, Flake8 does not allow to "noqa" just a specific error inside the file itself.
36-
# https://github.com/PyCQA/flake8/issues/1079
37-
# F811 redefinition of unused '...'
38-
stdlib/typing.pyi: B, E741, F401, F403, F405, F811
39-
# Generated protobuf files include docstrings,
40-
# and import some things from typing_extensions that could be imported from typing
41-
*_pb2.pyi: B, E741, F401, F403, F405, Y021, Y023, Y026, Y053, Y054
7+
# Generated protobuf files:
8+
# Y021: Include docstrings
9+
# Y023: Alias typing as typing_extensions
10+
# Y026: Have implicit type aliases
11+
# Y053: have literals >50 characters long
12+
stubs/*_pb2.pyi: Y021, Y023, Y026, Y053
4213

4314
exclude = .venv*,.git
44-
noqa_require_code = true

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
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
7-
tests/pytype_exclude_list.txt linguist-language=ini
6+
**/stubtest_allowlists/*.txt linguist-language=ini
87
pyrightconfig*.json linguist-language=jsonc
98
.vscode/*.json linguist-language=jsonc

.github/renovate.json5

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"dependencyDashboard": true,
4+
"suppressNotifications": ["prEditedNotification"],
5+
"extends": ["config:recommended"],
6+
"labels": ["bot: dependencies"],
7+
"semanticCommits": "disabled",
8+
"separateMajorMinor": false,
9+
"prHourlyLimit": 10,
10+
// This package rule disables updates for `actions/setup-python` Python versions:
11+
// it's better to do these manually as there's often a reason why we can't use
12+
// the latest Python version in CI for a specific job
13+
ignoreDeps: ["python"],
14+
"pre-commit": {
15+
"enabled": true
16+
},
17+
"packageRules": [
18+
{
19+
groupName: "GitHub Actions",
20+
matchManagers: ["github-actions"],
21+
description: "Quarterly update of GitHub Action dependencies",
22+
schedule: ["every 3 months on the first day of the month"]
23+
},
24+
{
25+
groupName: "most test/lint dependencies",
26+
matchManagers: ["pip_requirements", "pre-commit"],
27+
matchPackageNames: ["!pyright"],
28+
description: "Quarterly update of most test dependencies",
29+
schedule: ["every 3 months on the first day of the month"]
30+
},
31+
{
32+
"groupName": "pyright",
33+
"matchManagers": ["pip_requirements"],
34+
"matchPackageNames": ["pyright"],
35+
"description": "Daily update of pyright",
36+
"schedule": ["before 4am"]
37+
}
38+
]
39+
}

.github/workflows/daily.yml

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,19 @@ env:
2929

3030
jobs:
3131
stubtest-stdlib:
32-
name: Check stdlib with stubtest
33-
if: ${{ github.repository == 'python/typeshed' || github.event_name == 'workflow_dispatch' }}
32+
name: "stubtest: stdlib"
33+
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
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+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
38+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
4039
fail-fast: false
4140

4241
steps:
43-
- uses: actions/checkout@v4
42+
- uses: actions/checkout@v5
4443
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
45-
uses: actions/setup-python@v4
44+
uses: actions/setup-python@v6
4645
with:
4746
python-version: ${{ matrix.python-version }}
4847
cache: pip
@@ -51,96 +50,108 @@ jobs:
5150
check-latest: true
5251
- name: Install dependencies
5352
run: pip install -r requirements-tests.txt
53+
# Temporary to get @disjoint_base support; can remove once mypy 1.18 is released
54+
- name: Install mypy from git
55+
run: pip install git+https://github.com/python/mypy.git@116b92bae7b5dbf5e6bd36fd9b0c6804973e5554
5456
- name: Run stubtest
5557
run: python tests/stubtest_stdlib.py
5658

5759
stubtest-third-party:
58-
name: Check third party stubs with stubtest
59-
if: ${{ github.repository == 'python/typeshed' || github.event_name == 'workflow_dispatch' }}
60+
name: "stubtest: third party"
61+
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
6062
runs-on: ${{ matrix.os }}
6163
strategy:
6264
matrix:
6365
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
6466
shard-index: [0, 1, 2, 3]
6567
fail-fast: false
6668
steps:
67-
- uses: actions/checkout@v4
68-
- uses: actions/setup-python@v4
69+
- uses: actions/checkout@v5
70+
- uses: actions/setup-python@v6
6971
with:
70-
python-version: "3.10"
72+
python-version: "3.13"
7173
cache: pip
7274
cache-dependency-path: |
7375
requirements-tests.txt
7476
stubs/**/METADATA.toml
7577
- name: Install dependencies
7678
run: pip install -r requirements-tests.txt
77-
- name: Run stubtest
79+
- name: Install required system packages
7880
shell: bash
7981
run: |
8082
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
8183
8284
if [ "${{ runner.os }}" = "Linux" ]; then
8385
if [ -n "$PACKAGES" ]; then
84-
sudo apt update && sudo apt install -y $PACKAGES
86+
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
87+
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
8588
fi
86-
87-
PYTHON_EXECUTABLE="xvfb-run python"
8889
else
8990
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
90-
brew install $PACKAGES
91+
printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
92+
brew install -q $PACKAGES
9193
fi
9294
9395
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
96+
printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
9497
choco install -y $PACKAGES
9598
fi
96-
99+
fi
100+
- name: Run stubtest
101+
shell: bash
102+
run: |
103+
if [ "${{ runner.os }}" = "Linux" ]; then
104+
PYTHON_EXECUTABLE="xvfb-run python"
105+
else
97106
PYTHON_EXECUTABLE="python"
98107
fi
99108
100-
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --specified-platforms-only --num-shards 4 --shard-index ${{ matrix.shard-index }}
109+
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only --num-shards 4 --shard-index ${{ matrix.shard-index }}
101110
102111
stub-uploader:
103-
name: Run the stub_uploader tests
104-
if: ${{ github.repository == 'python/typeshed' || github.event_name == 'workflow_dispatch' }}
112+
name: stub_uploader tests
113+
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
105114
runs-on: ubuntu-latest
106115
steps:
107116
- name: Checkout typeshed
108-
uses: actions/checkout@v4
117+
uses: actions/checkout@v5
109118
with:
110119
path: typeshed
111120
- name: Checkout stub_uploader
112-
uses: actions/checkout@v4
121+
uses: actions/checkout@v5
113122
with:
114123
repository: typeshed-internal/stub_uploader
115124
path: stub_uploader
116-
- uses: actions/setup-python@v4
125+
- uses: actions/setup-python@v6
117126
with:
118-
python-version: "3.11"
119-
cache: pip
120-
cache-dependency-path: stub_uploader/requirements.txt
127+
# Keep in sync with stub_uploader's check_scripts.yml workflow.
128+
python-version: "3.13"
129+
- uses: astral-sh/setup-uv@v6
130+
with:
131+
version-file: "typeshed/requirements-tests.txt"
121132
- name: Run tests
122133
run: |
123134
cd stub_uploader
124-
pip install -r requirements.txt
135+
uv pip install -r requirements.txt --system
125136
python -m pytest tests
126137
127138
# https://github.community/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2
128139
create-issue-on-failure:
129-
name: Create an issue if daily tests failed
140+
name: Create issue on failure
130141
runs-on: ubuntu-latest
131142
needs: [stubtest-stdlib, stubtest-third-party, stub-uploader]
132-
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') }}
143+
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') }}
133144
permissions:
134145
issues: write
135146
steps:
136-
- uses: actions/github-script@v6
147+
- uses: actions/github-script@v8
137148
with:
138149
github-token: ${{ secrets.GITHUB_TOKEN }}
139150
script: |
140151
await github.rest.issues.create({
141152
owner: "python",
142153
repo: "typeshed",
143154
title: `Daily tests failed on ${new Date().toDateString()}`,
144-
body: "Runs listed here: https://github.com/python/typeshed/actions/workflows/daily.yml",
155+
body: "Run listed here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
145156
labels: ["help wanted"],
146157
})

.github/workflows/meta_tests.yml

Lines changed: 25 additions & 27 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"
@@ -27,62 +28,59 @@ concurrency:
2728

2829
jobs:
2930
mypy:
30-
name: Run mypy against the scripts and tests directories
31+
name: Check scripts and tests with mypy
3132
runs-on: ubuntu-latest
3233
strategy:
3334
matrix:
3435
platform: ["linux", "win32"]
3536
fail-fast: false
3637
steps:
37-
- uses: actions/checkout@v4
38-
- uses: actions/setup-python@v4
38+
- uses: actions/checkout@v5
39+
- uses: actions/setup-python@v6
3940
with:
40-
python-version: "3.11"
41-
cache: pip
42-
cache-dependency-path: requirements-tests.txt
43-
- run: pip install -r requirements-tests.txt
41+
python-version: "3.13"
42+
- uses: astral-sh/setup-uv@v6
43+
with:
44+
version-file: "requirements-tests.txt"
45+
- run: uv pip install -r requirements-tests.txt --system
4446
- run: python ./tests/typecheck_typeshed.py --platform=${{ matrix.platform }}
4547
pyright:
46-
name: Run pyright against the scripts and tests directories
48+
name: Check scripts and tests with pyright
4749
runs-on: ubuntu-latest
4850
strategy:
4951
matrix:
5052
python-platform: ["Linux", "Windows"]
5153
fail-fast: false
5254
steps:
53-
- uses: actions/checkout@v4
54-
- uses: actions/setup-python@v4
55+
- uses: actions/checkout@v5
56+
- uses: actions/setup-python@v6
5557
with:
56-
python-version: "3.9"
57-
cache: pip
58-
cache-dependency-path: requirements-tests.txt
59-
- run: pip install -r requirements-tests.txt
60-
- name: Get pyright version
61-
uses: SebRollen/[email protected]
62-
id: pyright_version
58+
python-version: "3.13"
59+
- uses: astral-sh/setup-uv@v6
6360
with:
64-
file: "pyproject.toml"
65-
field: "tool.typeshed.pyright_version"
61+
version-file: "requirements-tests.txt"
62+
- run: uv pip install -r requirements-tests.txt --system
6663
- name: Run pyright on typeshed
6764
uses: jakebailey/pyright-action@v2
6865
with:
69-
version: ${{ steps.pyright_version.outputs.value }}
66+
version: PATH
7067
python-platform: ${{ matrix.python-platform }}
71-
python-version: "3.9"
68+
python-version: "3.9" # Oldest version supported for running scripts and tests
7269
project: ./pyrightconfig.scripts_and_tests.json
7370
stubsabot-dry-run:
7471
name: Stubsabot dry run
7572
runs-on: ubuntu-latest
7673
steps:
77-
- uses: actions/checkout@v4
78-
- uses: actions/setup-python@v4
74+
- uses: actions/checkout@v5
75+
- uses: actions/setup-python@v6
76+
with:
77+
python-version: "3.13"
78+
- uses: astral-sh/setup-uv@v6
7979
with:
80-
python-version: "3.11"
81-
cache: pip
82-
cache-dependency-path: requirements-tests.txt
80+
version-file: "requirements-tests.txt"
8381
- name: Git config
8482
run: |
8583
git config --global user.name stubsabot
8684
git config --global user.email '<>'
87-
- run: pip install -r requirements-tests.txt
85+
- run: uv pip install -r requirements-tests.txt --system
8886
- run: python scripts/stubsabot.py --action-level local

0 commit comments

Comments
 (0)