Skip to content

Commit 5645e03

Browse files
committed
Merge branch 'main' of https://github.com/python/typeshed into using-dependency-groups-for-dev-dependencies
2 parents 1ffe8ea + 6af8f28 commit 5645e03

File tree

1,141 files changed

+21140
-10650
lines changed

Some content is hidden

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

1,141 files changed

+21140
-10650
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
# Set linguist-language to support comments syntax highlight
55
**/stubtest_allowlist*.txt linguist-language=ini
66
**/stubtest_allowlists/*.txt linguist-language=ini
7-
tests/pytype_exclude_list.txt linguist-language=ini
87
pyrightconfig*.json linguist-language=jsonc
98
.vscode/*.json linguist-language=jsonc

.github/renovate.json5

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
{
2525
groupName: "most test/lint dependencies",
2626
matchManagers: ["pip_requirements", "pre-commit"],
27-
matchPackageNames: ["!pytype", "!pyright"],
27+
matchPackageNames: ["!pyright"],
2828
description: "Quarterly update of most test dependencies",
2929
schedule: ["every 3 months on the first day of the month"]
3030
},
3131
{
32-
"groupName": "pytype and pyright",
32+
"groupName": "pyright",
3333
"matchManagers": ["pip_requirements"],
34-
"matchPackageNames": ["pytype", "pyright"],
35-
"description": "Daily update of pyright and pytype",
34+
"matchPackageNames": ["pyright"],
35+
"description": "Daily update of pyright",
3636
"schedule": ["before 4am"]
3737
}
3838
]

.github/workflows/daily.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ env:
3030
jobs:
3131
stubtest-stdlib:
3232
name: "stubtest: stdlib"
33-
if: ${{ github.repository == 'python/typeshed' || github.event_name == 'workflow_dispatch' }}
33+
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
3434
runs-on: ${{ matrix.os }}
3535
strategy:
3636
matrix:
3737
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
38-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
38+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
3939
fail-fast: false
4040

4141
steps:
@@ -55,7 +55,7 @@ jobs:
5555

5656
stubtest-third-party:
5757
name: "stubtest: third party"
58-
if: ${{ github.repository == 'python/typeshed' || github.event_name == 'workflow_dispatch' }}
58+
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
5959
runs-on: ${{ matrix.os }}
6060
strategy:
6161
matrix:
@@ -73,34 +73,41 @@ jobs:
7373
stubs/**/METADATA.toml
7474
- name: Install dependencies
7575
run: pip install --group=dev
76-
- name: Run stubtest
76+
- name: Install required system packages
7777
shell: bash
7878
run: |
7979
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
8080
8181
if [ "${{ runner.os }}" = "Linux" ]; then
8282
if [ -n "$PACKAGES" ]; then
83+
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
8384
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
8485
fi
85-
86-
PYTHON_EXECUTABLE="xvfb-run python"
8786
else
8887
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
88+
printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
8989
brew install -q $PACKAGES
9090
fi
9191
9292
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
93+
printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
9394
choco install -y $PACKAGES
9495
fi
95-
96+
fi
97+
- name: Run stubtest
98+
shell: bash
99+
run: |
100+
if [ "${{ runner.os }}" = "Linux" ]; then
101+
PYTHON_EXECUTABLE="xvfb-run python"
102+
else
96103
PYTHON_EXECUTABLE="python"
97104
fi
98105
99-
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --specified-platforms-only --num-shards 4 --shard-index ${{ matrix.shard-index }}
106+
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only --num-shards 4 --shard-index ${{ matrix.shard-index }}
100107
101108
stub-uploader:
102109
name: stub_uploader tests
103-
if: ${{ github.repository == 'python/typeshed' || github.event_name == 'workflow_dispatch' }}
110+
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
104111
runs-on: ubuntu-latest
105112
steps:
106113
- name: Checkout typeshed
@@ -117,6 +124,8 @@ jobs:
117124
# Keep in sync with stub_uploader's check_scripts.yml workflow.
118125
python-version: "3.13"
119126
- uses: astral-sh/setup-uv@v6
127+
with:
128+
version-file: "typeshed/pyproject.toml"
120129
- name: Run tests
121130
run: |
122131
cd stub_uploader

.github/workflows/meta_tests.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ jobs:
3838
- uses: actions/setup-python@v5
3939
with:
4040
python-version: "3.13"
41-
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
41+
- uses: astral-sh/setup-uv@v6
42+
with:
43+
version-file: "pyproject.toml"
4244
- run: uv pip install --group=dev --system
4345
- run: python ./tests/typecheck_typeshed.py --platform=${{ matrix.platform }}
4446
pyright:
@@ -52,10 +54,10 @@ jobs:
5254
- uses: actions/checkout@v4
5355
- uses: actions/setup-python@v5
5456
with:
55-
# TODO: Since pytype is not available for Python 3.13, and
56-
# pytype_test.py imports pytype, we need to use Python 3.12 for now.
57-
python-version: "3.12"
58-
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
57+
python-version: "3.13"
58+
- uses: astral-sh/setup-uv@v6
59+
with:
60+
version-file: "pyproject.toml"
5961
- run: uv pip install --group=dev --system
6062
- name: Run pyright on typeshed
6163
uses: jakebailey/pyright-action@v2
@@ -72,7 +74,9 @@ jobs:
7274
- uses: actions/setup-python@v5
7375
with:
7476
python-version: "3.13"
75-
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
77+
- uses: astral-sh/setup-uv@v6
78+
with:
79+
version-file: "pyproject.toml"
7680
- name: Git config
7781
run: |
7882
git config --global user.name stubsabot

.github/workflows/stubsabot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ jobs:
2727
- uses: actions/setup-python@v5
2828
with:
2929
python-version: "3.13"
30-
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
30+
- uses: astral-sh/setup-uv@v6
31+
with:
32+
version-file: "pyproject.toml"
3133
- name: git config
3234
run: |
3335
git config --global user.name stubsabot

.github/workflows/stubtest_stdlib.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
matrix:
3333
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
34-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
34+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
3535
fail-fast: false
3636

3737
steps:

.github/workflows/stubtest_third_party.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,44 +48,54 @@ jobs:
4848
stubs/**/METADATA.toml
4949
- name: Install dependencies
5050
run: pip install --group=dev
51-
- name: Run stubtest
51+
- name: Determine changed stubs
5252
shell: bash
5353
run: |
5454
# This only runs stubtest on changed stubs, because it is much faster.
5555
# Use the daily.yml workflow to run stubtest on all third party stubs.
5656
function find_stubs {
5757
git diff --name-only origin/${{ github.base_ref }} HEAD | \
5858
egrep ^stubs/ | cut -d "/" -f 2 | sort -u | \
59-
(while read stub; do [ -d "stubs/$stub" ] && echo "$stub" || true; done)
59+
(while read stub; do [ -d "stubs/$stub" ] && echo -n "$stub " || true; done)
6060
}
6161
STUBS=$(find_stubs || echo '')
62-
62+
echo "Changed stubs: $STUBS"
63+
echo "STUBS=$STUBS" >> $GITHUB_ENV
64+
- name: Install required system packages
65+
shell: bash
66+
run: |
6367
if [ -n "$STUBS" ]; then
64-
echo "Testing $STUBS..."
6568
PACKAGES=$(python tests/get_stubtest_system_requirements.py $STUBS)
66-
6769
if [ "${{ runner.os }}" = "Linux" ]; then
6870
if [ -n "$PACKAGES" ]; then
69-
echo "Installing apt packages: $PACKAGES"
71+
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
7072
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
7173
fi
72-
73-
PYTHON_EXECUTABLE="xvfb-run python"
7474
else
7575
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
76-
echo "Installing Homebrew packages: $PACKAGES"
76+
printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
7777
brew install -q $PACKAGES
7878
fi
7979
8080
if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
81-
echo "Installing Chocolatey packages: $PACKAGES"
81+
printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
8282
choco install -y $PACKAGES
8383
fi
84+
fi
85+
fi
86+
- name: Run stubtest
87+
shell: bash
88+
run: |
89+
if [ -n "$STUBS" ]; then
90+
echo "Testing $STUBS..."
8491
92+
if [ "${{ runner.os }}" = "Linux" ]; then
93+
PYTHON_EXECUTABLE="xvfb-run python"
94+
else
8595
PYTHON_EXECUTABLE="python"
8696
fi
8797
88-
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --specified-platforms-only $STUBS
98+
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only $STUBS
8999
else
90100
echo "Nothing to test"
91101
fi

.github/workflows/tests.yml

Lines changed: 31 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -30,66 +30,42 @@ jobs:
3030
- uses: actions/setup-python@v5
3131
with:
3232
python-version: "3.13"
33-
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
34-
- run: uv pip install --group=dev --system
35-
- run: python ./tests/check_typeshed_structure.py
36-
37-
pytype:
38-
name: "pytype: Check stubs"
39-
runs-on: ubuntu-latest
40-
steps:
41-
- uses: actions/checkout@v4
42-
- uses: actions/setup-python@v5
43-
with:
44-
# Max supported Python version as of pytype 2024.10.11
45-
python-version: "3.12"
4633
- uses: astral-sh/setup-uv@v6
34+
with:
35+
version-file: "pyproject.toml"
4736
- run: uv pip install --group=dev --system
48-
- name: Install external dependencies for 3rd-party stubs
49-
run: |
50-
DEPENDENCIES=$( python tests/get_external_stub_requirements.py )
51-
if [ -n "$DEPENDENCIES" ]; then
52-
printf "Installing packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
53-
uv pip install --system $DEPENDENCIES
54-
fi
55-
- run: uv pip freeze
56-
- run: ./tests/pytype_test.py --print-stderr
37+
- run: python ./tests/check_typeshed_structure.py
5738

5839
mypy:
5940
name: "mypy: Check stubs"
6041
runs-on: ubuntu-latest
6142
strategy:
6243
matrix:
6344
platform: ["linux", "win32", "darwin"]
64-
# TODO (2025-05-10) "3.13.2" should be "3.14-dev", see below.
65-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13.2"]
45+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
6646
fail-fast: false
6747
steps:
6848
- uses: actions/checkout@v4
6949
- uses: actions/setup-python@v5
7050
with:
7151
python-version: ${{ matrix.python-version }}
72-
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
52+
allow-prereleases: true
53+
- uses: astral-sh/setup-uv@v6
54+
with:
55+
version-file: "pyproject.toml"
7356
- run: uv pip install -r requirements-tests.txt --system
7457
- name: Install required APT packages
7558
run: |
76-
sudo apt-get update -qy
77-
DEPENDENCIES=$( python tests/get_external_apt_dependencies.py )
78-
if [ -n "$DEPENDENCIES" ]; then
79-
printf "Installing APT packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
80-
sudo apt-get install -qy $DEPENDENCIES
59+
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
60+
if [ -n "$PACKAGES" ]; then
61+
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
62+
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
8163
fi
8264
- name: Run mypy_test.py
8365
run: |
84-
# TODO: (2025-05-10) This is a bad hack to work around mypy crashing
85-
# when running on Python 3.14. See https://github.com/python/mypy/pull/19020.
86-
if [[ "${{ matrix.python-version }}" == "3.13.2" ]]; then
87-
MYPY_PY_VERSION="3.14"
88-
else
89-
# python-version can sometimes be pinned to a specific version or to "-dev", but
90-
# mypy understands only X.Y version numbers.
91-
MYPY_PY_VERSION=$(echo ${{ matrix.python-version }} | cut -d - -f 1 | cut -d . -f 1-2)
92-
fi
66+
# python-version can sometimes be pinned to a specific version or to "-dev", but
67+
# mypy understands only X.Y version numbers.
68+
MYPY_PY_VERSION=$(echo ${{ matrix.python-version }} | cut -d - -f 1 | cut -d . -f 1-2)
9369
python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${MYPY_PY_VERSION}
9470
9571
regression-tests:
@@ -102,7 +78,9 @@ jobs:
10278
# Use py311 for now, as py312 seems to be around 30s slower in CI
10379
# TODO: figure out why that is (#11590)
10480
python-version: "3.11"
105-
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
81+
- uses: astral-sh/setup-uv@v6
82+
with:
83+
version-file: "pyproject.toml"
10684
- run: uv pip install --group=dev --system
10785
- run: python ./tests/regr_test.py --all --verbosity QUIET
10886

@@ -120,25 +98,26 @@ jobs:
12098
with:
12199
python-version: "3.13"
122100
- uses: astral-sh/setup-uv@v6
101+
with:
102+
version-file: "pyproject.toml"
123103
- name: Install typeshed test-suite requirements
124-
# Install these so we can run `get_external_stub_requirements.py`
104+
# Install these so we can run `get_*_requirements.py`
125105
run: uv pip install --group=dev --system
126106
- name: Install required APT packages
127107
run: |
128-
sudo apt-get update -qy
129-
DEPENDENCIES=$( python tests/get_external_apt_dependencies.py )
130-
if [ -n "$DEPENDENCIES" ]; then
131-
printf "Installing APT packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
132-
sudo apt-get install -qy $DEPENDENCIES
108+
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
109+
if [ -n "$PACKAGES" ]; then
110+
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
111+
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
133112
fi
134113
- name: Create an isolated venv for testing
135114
run: uv venv .venv
136115
- name: Install 3rd-party stub dependencies
137116
run: |
138-
DEPENDENCIES=$( python tests/get_external_stub_requirements.py )
139-
if [ -n "$DEPENDENCIES" ]; then
140-
printf "Installing packages:\n $(echo $DEPENDENCIES | sed 's/ /\n /g')\n"
141-
uv pip install --python-version ${{ matrix.python-version }} $DEPENDENCIES
117+
PACKAGES=$(python tests/get_external_stub_requirements.py)
118+
if [ -n "$PACKAGES" ]; then
119+
printf "Installing python packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
120+
uv pip install --python-version ${{ matrix.python-version }} $PACKAGES
142121
fi
143122
- name: Activate the isolated venv for the rest of the job
144123
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
@@ -186,6 +165,8 @@ jobs:
186165
# Keep in sync with stub_uploader's check_scripts.yml workflow.
187166
python-version: "3.13"
188167
- uses: astral-sh/setup-uv@v6
168+
with:
169+
version-file: "typeshed/requirements-tests.txt"
189170
- name: Run tests
190171
run: |
191172
cd stub_uploader

0 commit comments

Comments
 (0)