Skip to content

Third-party tests

Third-party tests #906

Workflow file for this run

# This workflow is a daily cron job,
# running the tests of various third-party libraries that use us.
# This helps us spot regressions early,
# and helps flag when third-party libraries are making incorrect assumptions
# that might cause them to break when we cut a new release.
name: Third-party tests
on:
schedule:
- cron: "30 2 * * *" # 02:30 UTC
pull_request:
paths:
- ".github/workflows/third_party.yml"
workflow_dispatch:
permissions:
contents: read
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
FORCE_COLOR: 1
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
skip-schedule-on-fork:
name: Check for schedule trigger on fork
runs-on: ubuntu-latest
# if 'schedule' was the trigger,
# don't run it on contributors' forks
if: >-
github.repository == 'python/typing_extensions'
|| github.event_name != 'schedule'
steps:
- run: "true"
pydantic:
name: pydantic tests
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
# PyPy is deliberately omitted here,
# since pydantic's tests intermittently segfault on PyPy,
# and it's nothing to do with typing_extensions
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Checkout pydantic
run: git clone --depth=1 https://github.com/pydantic/pydantic.git || git clone --depth=1 https://github.com/pydantic/pydantic.git
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Run tests with typing_extensions main branch
working-directory: pydantic
run: |
uv add --editable ../typing-extensions-latest
uv sync --group dev
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
printf "\n\n"
uv run pytest
typing_inspect:
name: typing_inspect tests
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Checkout typing_inspect
run: git clone --depth=1 https://github.com/ilevkivskyi/typing_inspect.git || git clone --depth=1 https://github.com/ilevkivskyi/typing_inspect.git
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Run tests with typing_extensions main branch
working-directory: typing_inspect
run: |
set -x
uv venv .venv
uv pip install -r test-requirements.txt --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
uv pip install -e "typing-extensions @ ../typing-extensions-latest"
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
uv run --no-project pytest
pycroscope:
name: pycroscope tests
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Check out pycroscope
run: git clone --depth=1 https://github.com/JelleZijlstra/pycroscope.git || git clone --depth=1 https://github.com/JelleZijlstra/pycroscope.git
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Run tests with typing_extensions main branch
working-directory: pycroscope
run: |
set -x
uv venv .venv
uv pip install -e 'pycroscope[tests] @ .' --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
uv pip install -e "typing-extensions @ ../typing-extensions-latest"
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
uv run --no-project pytest pycroscope/
typeguard:
name: typeguard tests
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Check out typeguard
run: git clone --depth=1 https://github.com/agronholm/typeguard.git || git clone --depth=1 https://github.com/agronholm/typeguard.git
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Run tests with typing_extensions main branch
env:
PYTHON_COLORS: 0 # A test fails if tracebacks are colorized
working-directory: typeguard
run: |
set -x
uv venv .venv
uv pip install -e "typeguard @ ." --group test --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
uv pip install -e "typing-extensions @ ../typing-extensions-latest"
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
uv run --no-project pytest
typed-argument-parser:
name: typed-argument-parser tests
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Check out typed-argument-parser
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
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Configure git for typed-argument-parser tests
# typed-argument parser does this in their CI,
# and the tests fail unless we do this
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
- name: Run tests with typing_extensions main branch
working-directory: typed-argument-parser
run: |
set -x
uv venv .venv
uv pip install -e "typed-argument-parser @ ." --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
uv pip install pytest --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
uv pip install -e "typing-extensions @ ../typing-extensions-latest"
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
uv run --no-project pytest
mypy:
name: stubtest & mypyc tests
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Checkout mypy for stubtest and mypyc tests
run: git clone --depth=1 https://github.com/python/mypy.git || git clone --depth=1 https://github.com/python/mypy.git
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Run tests with typing_extensions main branch
working-directory: mypy
run: |
set -x
uv venv .venv
uv pip install -r test-requirements.txt --exclude-newer "$(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD)"
uv pip install -e .
uv pip install -e "typing_extensions @ ../typing-extensions-latest"
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
uv run --no-project pytest -n 2 ./mypy/test/teststubtest.py ./mypyc/test/test_run.py ./mypyc/test/test_external.py
cattrs:
name: cattrs tests
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Checkout cattrs
run: git clone --depth=1 https://github.com/python-attrs/cattrs.git || git clone --depth=1 https://github.com/python-attrs/cattrs.git
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Run tests with typing_extensions main branch
working-directory: cattrs
run: |
uv add --editable ../typing-extensions-latest
uv sync --group test --all-extras
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
printf "\n\n"
uv run pytest tests
sqlalchemy:
name: sqlalchemy tests
needs: skip-schedule-on-fork
strategy:
fail-fast: false
matrix:
# PyPy is deliberately omitted here, since SQLAlchemy's tests
# fail on PyPy for reasons unrelated to typing_extensions.
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
checkout-ref: [ "main", "rel_2_0" ]
# sqlalchemy tests fail when using the Ubuntu 24.04 runner
# https://github.com/sqlalchemy/sqlalchemy/commit/8d73205f352e68c6603e90494494ef21027ec68f
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Checkout sqlalchemy
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
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Run sqlalchemy tests with typing_extensions main branch
working-directory: sqlalchemy
run: |
set -x
uvx \
--with=setuptools \
tox -e github-nocext --force-dep="typing-extensions @ file://$(pwd)/../typing-extensions-latest" -- -q --nomemory --notimingintensive
litestar:
name: litestar tests
needs: skip-schedule-on-fork
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
with:
python-version: ${{ matrix.python-version }}
- name: Checkout litestar
run: git clone --depth=1 https://github.com/litestar-org/litestar.git || git clone --depth=1 https://github.com/litestar-org/litestar.git
- name: Checkout typing_extensions
uses: actions/checkout@v4
with:
path: typing-extensions-latest
persist-credentials: false
- name: Run litestar tests with typing_extensions main branch
working-directory: litestar
run: |
# litestar's python-requires means uv won't let us add typing-extensions-latest
# as a requirement unless we do this
sed -i 's/^requires-python = ">=3.8/requires-python = ">=3.9/' pyproject.toml
uv add --editable ../typing-extensions-latest
uv sync
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
printf "\n\n"
uv run python -m pytest tests/unit/test_typing.py tests/unit/test_dto
create-issue-on-failure:
name: Create an issue if daily tests failed
runs-on: ubuntu-latest
needs:
- pydantic
- typing_inspect
- pycroscope
- typeguard
- typed-argument-parser
- mypy
- cattrs
- sqlalchemy
if: >-
${{
github.repository == 'python/typing_extensions'
&& always()
&& github.event_name == 'schedule'
&& (
needs.pydantic.result == 'failure'
|| needs.typing_inspect.result == 'failure'
|| needs.pycroscope.result == 'failure'
|| needs.typeguard.result == 'failure'
|| needs.typed-argument-parser.result == 'failure'
|| needs.mypy.result == 'failure'
|| needs.cattrs.result == 'failure'
|| needs.sqlalchemy.result == 'failure'
)
}}
permissions:
issues: write
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.create({
owner: "python",
repo: "typing_extensions",
title: `Third-party tests failed on ${new Date().toDateString()}`,
body: "Run listed here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
})