Debian Codegraph @

.github/workflows/third_party.yml

raw
1 # This workflow is a daily cron job,
2 # running the tests of various third-party libraries that use us.
3 # This helps us spot regressions early,
4 # and helps flag when third-party libraries are making incorrect assumptions
5 # that might cause them to break when we cut a new release.
6
7 name: Third-party tests
8
9 on:
10 schedule:
11 - cron: "30 2 * * *" # 02:30 UTC
12 pull_request:
13 paths:
14 - ".github/workflows/third_party.yml"
15 workflow_dispatch:
16
17 permissions:
18 contents: read
19
20 env:
21 PIP_DISABLE_PIP_VERSION_CHECK: 1
22 FORCE_COLOR: 1
23
24 concurrency:
25 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
26 cancel-in-progress: true
27
28 jobs:
29 skip-schedule-on-fork:
30 name: Check for schedule trigger on fork
31 runs-on: ubuntu-latest
32 # if 'schedule' was the trigger,
33 # don't run it on contributors' forks
34 if: >-
35 github.repository == 'python/typing_extensions'
36 || github.event_name != 'schedule'
37 steps:
38 - run: "true"
39
40 pydantic:
41 name: pydantic tests
42 needs: skip-schedule-on-fork
43 strategy:
44 fail-fast: false
45 matrix:
46 # PyPy is deliberately omitted here,
47 # since pydantic's tests intermittently segfault on PyPy,
48 # and it's nothing to do with typing_extensions
49 # Tests on 3.14 don't pass as of 2 November 2025
50 python-version: ["3.10", "3.11", "3.12", "3.13"]
51 runs-on: ubuntu-latest
52 timeout-minutes: 60
53 steps:
54 - name: Install the latest version of uv
55 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
56 with:
57 python-version: ${{ matrix.python-version }}
58 - name: Checkout pydantic
59 run: git clone --depth=1 https://github.com/pydantic/pydantic.git || git clone --depth=1 https://github.com/pydantic/pydantic.git
60 - name: Checkout typing_extensions
61 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
62 with:
63 path: typing-extensions-latest
64 persist-credentials: false
65 - name: Run tests with typing_extensions main branch
66 working-directory: pydantic
67 run: |
68 uv add --editable ../typing-extensions-latest
69 uv sync --all-packages --group testing-extra --all-extras
70
71 printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
72 uv pip list
73 printf "\n\n"
74
75 uv run pytest
76
77 typing_inspect:
78 name: typing_inspect tests
79 needs: skip-schedule-on-fork
80 strategy:
81 fail-fast: false
82 matrix:
83 python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
84 runs-on: ubuntu-latest
85 timeout-minutes: 60
86 steps:
87 - name: Install the latest version of uv
88 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
89 with:
90 python-version: ${{ matrix.python-version }}
91 - name: Checkout typing_inspect
92 run: git clone --depth=1 https://github.com/ilevkivskyi/typing_inspect.git || git clone --depth=1 https://github.com/ilevkivskyi/typing_inspect.git
93 - name: Checkout typing_extensions
94 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
95 with:
96 path: typing-extensions-latest
97 persist-credentials: false
98 - name: Run tests with typing_extensions main branch
99 working-directory: typing_inspect
100 run: |
101 set -x
102 uv venv .venv
103
104 uv pip install -r test-requirements.txt --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
105 uv pip install -e "typing-extensions @ ../typing-extensions-latest"
106
107 printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
108 uv pip list
109
110 uv run --no-project pytest
111
112 pycroscope:
113 name: pycroscope tests
114 needs: skip-schedule-on-fork
115 strategy:
116 fail-fast: false
117 matrix:
118 python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
119 runs-on: ubuntu-latest
120 timeout-minutes: 60
121 steps:
122 - name: Install the latest version of uv
123 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
124 with:
125 python-version: ${{ matrix.python-version }}
126 - name: Check out pycroscope
127 run: git clone --depth=1 https://github.com/JelleZijlstra/pycroscope.git || git clone --depth=1 https://github.com/JelleZijlstra/pycroscope.git
128 - name: Checkout typing_extensions
129 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
130 with:
131 path: typing-extensions-latest
132 persist-credentials: false
133 - name: Run tests with typing_extensions main branch
134 working-directory: pycroscope
135 run: |
136 set -x
137 uv venv .venv
138
139 uv pip install -e 'pycroscope[tests] @ .' --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
140 uv pip install -e "typing-extensions @ ../typing-extensions-latest"
141
142 printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
143 uv pip list
144
145 uv run --no-project pytest pycroscope/
146
147 typeguard:
148 name: typeguard tests
149 needs: skip-schedule-on-fork
150 strategy:
151 fail-fast: false
152 matrix:
153 python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
154 runs-on: ubuntu-latest
155 timeout-minutes: 60
156 steps:
157 - name: Install the latest version of uv
158 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
159 with:
160 python-version: ${{ matrix.python-version }}
161 - name: Check out typeguard
162 run: git clone --depth=1 https://github.com/agronholm/typeguard.git || git clone --depth=1 https://github.com/agronholm/typeguard.git
163 - name: Checkout typing_extensions
164 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
165 with:
166 path: typing-extensions-latest
167 persist-credentials: false
168 - name: Run tests with typing_extensions main branch
169 env:
170 PYTHON_COLORS: 0 # A test fails if tracebacks are colorized
171 working-directory: typeguard
172 run: |
173 set -x
174 uv venv .venv
175
176 uv pip install -e "typeguard @ ." --group test --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
177 uv pip install -e "typing-extensions @ ../typing-extensions-latest"
178
179 printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
180 uv pip list
181
182 uv run --no-project pytest
183
184 typed-argument-parser:
185 name: typed-argument-parser tests
186 needs: skip-schedule-on-fork
187 strategy:
188 fail-fast: false
189 matrix:
190 # 3.9 is no longer supported. 3.14 fails some tests as of 2 November 2025
191 python-version: ["3.10", "3.11", "3.12", "3.13"]
192 runs-on: ubuntu-latest
193 timeout-minutes: 60
194 steps:
195 - name: Install the latest version of uv
196 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
197 with:
198 python-version: ${{ matrix.python-version }}
199 - name: Check out typed-argument-parser
200 run: git clone --depth=1 https://github.com/swansonk14/typed-argument-parser.git || git clone --depth=1 https://github.com/swansonk14/typed-argument-parser.git
201 - name: Checkout typing_extensions
202 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
203 with:
204 path: typing-extensions-latest
205 persist-credentials: false
206 - name: Configure git for typed-argument-parser tests
207 # typed-argument parser does this in their CI,
208 # and the tests fail unless we do this
209 run: |
210 git config --global user.email "[email protected]"
211 git config --global user.name "Your Name"
212 - name: Run tests with typing_extensions main branch
213 working-directory: typed-argument-parser
214 run: |
215 set -x
216 uv venv .venv
217
218 uv pip install -e "typed-argument-parser @ ." --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
219 uv pip install pytest --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
220 uv pip install -e "typing-extensions @ ../typing-extensions-latest"
221
222 printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
223 uv pip list
224
225 uv run --no-project pytest
226
227 mypy:
228 name: stubtest & mypyc tests
229 needs: skip-schedule-on-fork
230 strategy:
231 fail-fast: false
232 matrix:
233 # 3.14 fails a test as of 2 November 2025
234 python-version: ["3.10", "3.11", "3.12", "3.13"]
235 runs-on: ubuntu-latest
236 timeout-minutes: 60
237 steps:
238 - name: Install the latest version of uv
239 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
240 with:
241 python-version: ${{ matrix.python-version }}
242 - name: Checkout mypy for stubtest and mypyc tests
243 run: git clone --depth=1 https://github.com/python/mypy.git || git clone --depth=1 https://github.com/python/mypy.git
244 - name: Checkout typing_extensions
245 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
246 with:
247 path: typing-extensions-latest
248 persist-credentials: false
249 - name: Run tests with typing_extensions main branch
250 working-directory: mypy
251 run: |
252 set -x
253 uv venv .venv
254
255 uv pip install -r test-requirements.txt --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
256 uv pip install -e .
257 uv pip install -e "typing_extensions @ ../typing-extensions-latest"
258
259 printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
260 uv pip list
261
262 uv run --no-project pytest -n 2 ./mypy/test/teststubtest.py ./mypyc/test/test_run.py ./mypyc/test/test_external.py
263
264 cattrs:
265 name: cattrs tests
266 needs: skip-schedule-on-fork
267 strategy:
268 fail-fast: false
269 matrix:
270 python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
271 runs-on: ubuntu-latest
272 timeout-minutes: 60
273 steps:
274 - name: Install the latest version of uv
275 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
276 with:
277 python-version: ${{ matrix.python-version }}
278 - name: Checkout cattrs
279 run: git clone --depth=1 https://github.com/python-attrs/cattrs.git || git clone --depth=1 https://github.com/python-attrs/cattrs.git
280 - name: Checkout typing_extensions
281 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
282 with:
283 path: typing-extensions-latest
284 persist-credentials: false
285 - name: Run tests with typing_extensions main branch
286 working-directory: cattrs
287 run: |
288 uv add --editable ../typing-extensions-latest
289 uv sync --group test --all-extras
290
291 printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
292 uv pip list
293 printf "\n\n"
294
295 uv run pytest tests
296
297 sqlalchemy:
298 name: sqlalchemy tests
299 needs: skip-schedule-on-fork
300 strategy:
301 fail-fast: false
302 matrix:
303 # PyPy is deliberately omitted here, since SQLAlchemy's tests
304 # fail on PyPy for reasons unrelated to typing_extensions.
305 python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
306 checkout-ref: [ "main", "rel_2_0" ]
307 # sqlalchemy tests fail when using the Ubuntu 24.04 runner
308 # https://github.com/sqlalchemy/sqlalchemy/commit/8d73205f352e68c6603e90494494ef21027ec68f
309 runs-on: ubuntu-22.04
310 timeout-minutes: 60
311 steps:
312 - name: Install the latest version of uv
313 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
314 with:
315 python-version: ${{ matrix.python-version }}
316 - name: Checkout sqlalchemy
317 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
318 - name: Checkout typing_extensions
319 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
320 with:
321 path: typing-extensions-latest
322 persist-credentials: false
323 - name: Run sqlalchemy tests with typing_extensions main branch
324 working-directory: sqlalchemy
325 run: |
326 set -x
327 # TODO: Remove pytest==9.0.3 pin. SQLAlchemy tests fail when using pytest 9.1.0. See #764.
328 uvx \
329 --with=setuptools \
330 tox -e github-nocext --override "testenv:github-nocext.deps+=pytest==9.0.3" --force-dep="typing-extensions @ file://$(pwd)/../typing-extensions-latest" -- -q --nomemory --notimingintensive
331
332
333 litestar:
334 name: litestar tests
335 needs: skip-schedule-on-fork
336 runs-on: ubuntu-latest
337 timeout-minutes: 10
338 strategy:
339 fail-fast: false
340 matrix:
341 # As of 2 November 2025 a dependency is missing 3.14 wheels
342 python-version: [ "3.11", "3.12", "3.13" ]
343 steps:
344 - name: Install the latest version of uv
345 uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
346 with:
347 python-version: ${{ matrix.python-version }}
348 - name: Checkout litestar
349 run: git clone --depth=1 https://github.com/litestar-org/litestar.git || git clone --depth=1 https://github.com/litestar-org/litestar.git
350 - name: Checkout typing_extensions
351 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
352 with:
353 path: typing-extensions-latest
354 persist-credentials: false
355 - name: Run litestar tests with typing_extensions main branch
356 working-directory: litestar
357 run: |
358 # litestar's python-requires means uv won't let us add typing-extensions-latest
359 # as a requirement unless we do this
360 sed -i 's/^requires-python = ">=3.8/requires-python = ">=3.10/' pyproject.toml
361
362 uv add --editable ../typing-extensions-latest
363 uv sync
364
365 printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
366 uv pip list
367 printf "\n\n"
368
369 uv run python -m pytest tests/unit/test_typing.py tests/unit/test_dto
370
371 create-issue-on-failure:
372 name: Create an issue if daily tests failed
373 runs-on: ubuntu-latest
374
375 needs:
376 - pydantic
377 - typing_inspect
378 - pycroscope
379 - typeguard
380 - typed-argument-parser
381 - mypy
382 - cattrs
383 - sqlalchemy
384 - litestar
385
386 if: >-
387 ${{
388 github.repository == 'python/typing_extensions'
389 && always()
390 && github.event_name == 'schedule'
391 && (
392 needs.pydantic.result == 'failure'
393 || needs.typing_inspect.result == 'failure'
394 || needs.pycroscope.result == 'failure'
395 || needs.typeguard.result == 'failure'
396 || needs.typed-argument-parser.result == 'failure'
397 || needs.mypy.result == 'failure'
398 || needs.cattrs.result == 'failure'
399 || needs.sqlalchemy.result == 'failure'
400 || needs.litestar.result == 'failure'
401 )
402 }}
403
404 permissions:
405 issues: write
406
407 steps:
408 - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
409 with:
410 github-token: ${{ secrets.GITHUB_TOKEN }}
411 script: |
412 await github.rest.issues.create({
413 owner: "python",
414 repo: "typing_extensions",
415 title: `Third-party tests failed on ${new Date().toDateString()}`,
416 body: "Run listed here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
417 })