Skip to content

Commit 6e57223

Browse files
committed
Merge remote-tracking branch 'upstream' into upgrade-ruff
2 parents 9018936 + 887d794 commit 6e57223

15 files changed

Lines changed: 1577 additions & 1096 deletions

.github/workflows/ci.yml

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,11 @@ jobs:
2424
tests:
2525
name: Run tests
2626

27+
# if 'schedule' was the trigger,
28+
# don't run it on contributors' forks
2729
if: >-
28-
# if 'schedule' was the trigger,
29-
# don't run it on contributors' forks
30-
${{
31-
github.event_name != 'schedule'
32-
|| (
33-
github.repository == 'python/typing_extensions'
34-
&& github.event_name == 'schedule'
35-
)
36-
}}
30+
github.repository == 'python/typing_extensions'
31+
|| github.event_name != 'schedule'
3732
3833
strategy:
3934
fail-fast: false
@@ -43,23 +38,22 @@ jobs:
4338
# For available versions, see:
4439
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
4540
python-version:
46-
- "3.8"
47-
- "3.8.0"
4841
- "3.9"
49-
- "3.9.0"
42+
- "3.9.12"
5043
- "3.10"
51-
- "3.10.0"
44+
- "3.10.4"
5245
- "3.11"
5346
- "3.11.0"
5447
- "3.12"
5548
- "3.12.0"
5649
- "3.13"
5750
- "3.13.0"
58-
- "pypy3.8"
51+
- "3.14"
5952
- "pypy3.9"
6053
- "pypy3.10"
54+
- "pypy3.11"
6155

62-
runs-on: ubuntu-20.04
56+
runs-on: ubuntu-latest
6357

6458
steps:
6559
- uses: actions/checkout@v4
@@ -75,6 +69,7 @@ jobs:
7569
# Be wary of running `pip install` here, since it becomes easy for us to
7670
# accidentally pick up typing_extensions as installed by a dependency
7771
cd src
72+
python --version # just to make sure we're running the right one
7873
python -m unittest test_typing_extensions.py
7974
8075
- name: Test CPython typing test suite
@@ -86,27 +81,6 @@ jobs:
8681
# because we monkeypatch typing under some circumstances.
8782
python -c 'import typing_extensions; import test.__main__' test_typing -v
8883
89-
linting:
90-
name: Lint
91-
92-
# no reason to run this as a cron job
93-
if: github.event_name != 'schedule'
94-
95-
runs-on: ubuntu-latest
96-
97-
steps:
98-
- uses: actions/checkout@v4
99-
- name: Set up Python
100-
uses: actions/setup-python@v5
101-
with:
102-
python-version: "3"
103-
cache: "pip"
104-
cache-dependency-path: "test-requirements.txt"
105-
- name: Install dependencies
106-
run: pip install -r test-requirements.txt
107-
- name: Lint implementation
108-
run: ruff check
109-
11084
create-issue-on-failure:
11185
name: Create an issue if daily tests failed
11286
runs-on: ubuntu-latest

.github/workflows/publish.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ jobs:
6363
path: dist/
6464
- name: Install wheel
6565
run: |
66-
export path_to_file=$(find dist -type f -name "typing_extensions-*.whl")
66+
path_to_file="$(find dist -type f -name "typing_extensions-*.whl")"
67+
export path_to_file
6768
echo "::notice::Installing wheel: $path_to_file"
68-
python -m pip install --user $path_to_file
69+
python -m pip install --user "$path_to_file"
6970
python -m pip list
7071
- name: Run typing_extensions tests against installed package
7172
run: rm src/typing_extensions.py && python src/test_typing_extensions.py
@@ -89,10 +90,11 @@ jobs:
8990
path: dist/
9091
- name: Unpack and test source distribution
9192
run: |
92-
export path_to_file=$(find dist -type f -name "typing_extensions-*.tar.gz")
93+
path_to_file="$(find dist -type f -name "typing_extensions-*.tar.gz")"
94+
export path_to_file
9395
echo "::notice::Unpacking source distribution: $path_to_file"
94-
tar xzf $path_to_file -C dist/
95-
cd ${path_to_file%.tar.gz}/src
96+
tar xzf "$path_to_file" -C dist/
97+
cd "${path_to_file%.tar.gz}/src"
9698
python test_typing_extensions.py
9799
98100
test-sdist-installed:
@@ -114,9 +116,10 @@ jobs:
114116
path: dist/
115117
- name: Install source distribution
116118
run: |
117-
export path_to_file=$(find dist -type f -name "typing_extensions-*.tar.gz")
119+
path_to_file="$(find dist -type f -name "typing_extensions-*.tar.gz")"
120+
export path_to_file
118121
echo "::notice::Installing source distribution: $path_to_file"
119-
python -m pip install --user $path_to_file
122+
python -m pip install --user "$path_to_file"
120123
python -m pip list
121124
- name: Run typing_extensions tests against installed package
122125
run: rm src/typing_extensions.py && python src/test_typing_extensions.py
@@ -144,6 +147,6 @@ jobs:
144147
name: python-package-distributions
145148
path: dist/
146149
- name: Ensure exactly one sdist and one wheel have been downloaded
147-
run: test $(ls dist/*.tar.gz | wc -l) = 1 && test $(ls dist/*.whl | wc -l) = 1
150+
run: test "$(find dist/*.tar.gz | wc -l | xargs)" = 1 && test "$(find dist/*.whl | wc -l | xargs)" = 1
148151
- name: Publish distribution to PyPI
149152
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/third_party.yml

Lines changed: 91 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
github.repository == 'python/typing_extensions'
3636
|| github.event_name != 'schedule'
3737
steps:
38-
- run: true
38+
- run: "true"
3939

4040
pydantic:
4141
name: pydantic tests
@@ -98,7 +98,7 @@ jobs:
9898
run: |
9999
set -x
100100
cd typing_inspect
101-
uv pip install --system -r test-requirements.txt --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)
101+
uv pip install --system -r test-requirements.txt --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
102102
- name: Install typing_extensions latest
103103
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest"
104104
- name: List all installed dependencies
@@ -108,8 +108,8 @@ jobs:
108108
cd typing_inspect
109109
pytest
110110
111-
pyanalyze:
112-
name: pyanalyze tests
111+
pycroscope:
112+
name: pycroscope tests
113113
needs: skip-schedule-on-fork
114114
strategy:
115115
fail-fast: false
@@ -125,25 +125,25 @@ jobs:
125125
allow-prereleases: true
126126
- name: Install uv
127127
run: curl -LsSf https://astral.sh/uv/install.sh | sh
128-
- name: Check out pyanalyze
129-
run: git clone --depth=1 https://github.com/quora/pyanalyze.git || git clone --depth=1 https://github.com/quora/pyanalyze.git
128+
- name: Check out pycroscope
129+
run: git clone --depth=1 https://github.com/JelleZijlstra/pycroscope.git || git clone --depth=1 https://github.com/JelleZijlstra/pycroscope.git
130130
- name: Checkout typing_extensions
131131
uses: actions/checkout@v4
132132
with:
133133
path: typing-extensions-latest
134-
- name: Install pyanalyze test requirements
134+
- name: Install pycroscope test requirements
135135
run: |
136136
set -x
137-
cd pyanalyze
138-
uv pip install --system 'pyanalyze[tests] @ .' --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)
137+
cd pycroscope
138+
uv pip install --system 'pycroscope[tests] @ .' --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
139139
- name: Install typing_extensions latest
140140
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest"
141141
- name: List all installed dependencies
142142
run: uv pip freeze
143-
- name: Run pyanalyze tests
143+
- name: Run pycroscope tests
144144
run: |
145-
cd pyanalyze
146-
pytest pyanalyze/
145+
cd pycroscope
146+
pytest pycroscope/
147147
148148
typeguard:
149149
name: typeguard tests
@@ -172,7 +172,7 @@ jobs:
172172
run: |
173173
set -x
174174
cd typeguard
175-
uv pip install --system "typeguard[test] @ ." --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)
175+
uv pip install --system "typeguard @ ." --group test --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
176176
- name: Install typing_extensions latest
177177
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest"
178178
- name: List all installed dependencies
@@ -215,8 +215,8 @@ jobs:
215215
run: |
216216
set -x
217217
cd typed-argument-parser
218-
uv pip install --system "typed-argument-parser @ ." --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)
219-
uv pip install --system pytest --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)
218+
uv pip install --system "typed-argument-parser @ ." --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
219+
uv pip install --system pytest --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
220220
- name: Install typing_extensions latest
221221
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest"
222222
- name: List all installed dependencies
@@ -253,7 +253,7 @@ jobs:
253253
run: |
254254
set -x
255255
cd mypy
256-
uv pip install --system -r test-requirements.txt --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)
256+
uv pip install --system -r test-requirements.txt --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
257257
uv pip install --system -e .
258258
- name: Install typing_extensions latest
259259
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest"
@@ -270,8 +270,7 @@ jobs:
270270
strategy:
271271
fail-fast: false
272272
matrix:
273-
# skip 3.13 because msgspec doesn't support 3.13 yet
274-
python-version: ["3.9", "3.10", "3.11", "3.12"]
273+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
275274
runs-on: ubuntu-latest
276275
timeout-minutes: 60
277276
steps:
@@ -299,18 +298,89 @@ jobs:
299298
- name: Run cattrs tests
300299
run: cd cattrs; pdm run pytest tests
301300

301+
sqlalchemy:
302+
name: sqlalchemy tests
303+
needs: skip-schedule-on-fork
304+
strategy:
305+
fail-fast: false
306+
matrix:
307+
# PyPy is deliberately omitted here, since SQLAlchemy's tests
308+
# fail on PyPy for reasons unrelated to typing_extensions.
309+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
310+
checkout-ref: [ "main", "rel_2_0" ]
311+
# sqlalchemy tests fail when using the Ubuntu 24.04 runner
312+
# https://github.com/sqlalchemy/sqlalchemy/commit/8d73205f352e68c6603e90494494ef21027ec68f
313+
runs-on: ubuntu-22.04
314+
timeout-minutes: 60
315+
steps:
316+
- name: Setup Python
317+
uses: actions/setup-python@v5
318+
with:
319+
python-version: ${{ matrix.python-version }}
320+
allow-prereleases: true
321+
- name: Install uv
322+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
323+
- name: Checkout sqlalchemy
324+
run: git clone -b ${{ matrix.checkout-ref }} --depth=1 https://github.com/sqlalchemy/sqlalchemy.git || git clone -b ${{ matrix.checkout-ref }} --depth=1 https://github.com/sqlalchemy/sqlalchemy.git
325+
- name: Checkout typing_extensions
326+
uses: actions/checkout@v4
327+
with:
328+
path: typing-extensions-latest
329+
- name: Install sqlalchemy test dependencies
330+
run: uv pip install --system tox setuptools
331+
- name: List installed dependencies
332+
# Note: tox installs SQLAlchemy and its dependencies in a different isolated
333+
# environment before running the tests. To see the dependencies installed
334+
# in the test environment, look for the line 'freeze> python -m pip freeze --all'
335+
# in the output of the test step below.
336+
run: uv pip list
337+
- name: Run sqlalchemy tests
338+
run: |
339+
cd sqlalchemy
340+
tox -e github-nocext \
341+
--force-dep "typing-extensions @ file://$(pwd)/../typing-extensions-latest" \
342+
-- -q --nomemory --notimingintensive
343+
344+
345+
litestar:
346+
name: litestar tests
347+
needs: skip-schedule-on-fork
348+
runs-on: ubuntu-latest
349+
timeout-minutes: 10
350+
strategy:
351+
fail-fast: false
352+
matrix:
353+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
354+
steps:
355+
- name: Setup Python
356+
uses: actions/setup-python@v5
357+
with:
358+
python-version: ${{ matrix.python-version }}
359+
- name: Checkout litestar
360+
run: git clone --depth=1 https://github.com/litestar-org/litestar.git || git clone --depth=1 https://github.com/litestar-org/litestar.git
361+
- name: Checkout typing_extensions
362+
uses: actions/checkout@v4
363+
with:
364+
path: typing-extensions-latest
365+
- name: Install uv
366+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
367+
- name: Run litestar tests
368+
run: uv run --with=../typing-extensions-latest -- python -m pytest tests/unit/test_typing.py tests/unit/test_dto
369+
working-directory: litestar
370+
302371
create-issue-on-failure:
303372
name: Create an issue if daily tests failed
304373
runs-on: ubuntu-latest
305374

306375
needs:
307376
- pydantic
308377
- typing_inspect
309-
- pyanalyze
378+
- pycroscope
310379
- typeguard
311380
- typed-argument-parser
312381
- mypy
313382
- cattrs
383+
- sqlalchemy
314384

315385
if: >-
316386
${{
@@ -320,11 +390,12 @@ jobs:
320390
&& (
321391
needs.pydantic.result == 'failure'
322392
|| needs.typing_inspect.result == 'failure'
323-
|| needs.pyanalyze.result == 'failure'
393+
|| needs.pycroscope.result == 'failure'
324394
|| needs.typeguard.result == 'failure'
325395
|| needs.typed-argument-parser.result == 'failure'
326396
|| needs.mypy.result == 'failure'
327397
|| needs.cattrs.result == 'failure'
398+
|| needs.sqlalchemy.result == 'failure'
328399
)
329400
}}
330401

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.9.6
4+
hooks:
5+
- id: ruff
6+
args: [--fix, --exit-non-zero-on-fix]
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v4.5.0
9+
hooks:
10+
- id: trailing-whitespace
11+
- id: end-of-file-fixer
12+
- id: check-docstring-first
13+
- id: check-yaml
14+
- id: check-toml
15+
- id: check-merge-conflict
16+
- id: check-case-conflict
17+
- id: forbid-submodules
18+
- id: mixed-line-ending
19+
args: [--fix=lf]
20+
- repo: https://github.com/python-jsonschema/check-jsonschema
21+
rev: 0.33.0
22+
hooks:
23+
- id: check-dependabot
24+
- id: check-github-workflows
25+
- id: check-readthedocs
26+
- repo: https://github.com/abravalheri/validate-pyproject
27+
rev: v0.24.1
28+
hooks:
29+
- id: validate-pyproject
30+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
31+
- repo: https://github.com/rhysd/actionlint
32+
rev: v1.7.7
33+
hooks:
34+
- id: actionlint
35+
additional_dependencies:
36+
# actionlint has a shellcheck integration which extracts shell scripts in `run:` steps from GitHub Actions
37+
# and checks these with shellcheck. This is arguably its most useful feature,
38+
# but the integration only works if shellcheck is installed
39+
- "github.com/wasilibs/go-shellcheck/cmd/shellcheck@v0.10.0"
40+
- repo: meta
41+
hooks:
42+
- id: check-hooks-apply

.readthedocs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ build:
1010

1111
sphinx:
1212
configuration: doc/conf.py
13-

0 commit comments

Comments
 (0)