From c1d789f279970c6791c41f14212ae1b606e39445 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Thu, 26 Mar 2026 00:48:54 +0100 Subject: [PATCH] CI: Use `uv` exclusively (#606) ## About That's just maintenance. In this case, streamline the CI configuration for improved ergonomics and future proofing, see GH-605. ## Details - `activate-environment: true` of newer `astral-sh/setup-uv@v7` is the killer feature here, which wasn't available before. - Configuring `cache-dependency-glob: pyproject.toml` isn't needed, because the recipe already employs an excellent default configuration that includes this and other project metadata files. - The adjustments in `test_cli` were needed because of a different PyPy version installed by `setup-uv`. This will yield a report to Astral maintainers, unrelated to this patch. --- .github/workflows/docs.yaml | 16 ++++------------ .github/workflows/test.yaml | 16 ++++------------ tests/test_cli.py | 7 ++++++- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index aa00210..496b692 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -19,24 +19,16 @@ jobs: documentation: name: "Documentation" runs-on: ubuntu-latest - env: - UV_SYSTEM_PYTHON: true steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@v7 with: - python-version: "3.13" - - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - version: "latest" + activate-environment: true enable-cache: true - cache-dependency-glob: | - pyproject.toml + python-version: "3.14" - name: Install package and documentation dependencies run: uv pip install '.[docs]' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a3ce2a9..b6b8f7f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -28,8 +28,6 @@ jobs: "3.14t", "pypy3.11", ] - env: - UV_SYSTEM_PYTHON: true steps: - uses: actions/checkout@v4 @@ -37,19 +35,13 @@ jobs: with: node-version: 22 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@v7 with: - python-version: ${{ matrix.python-version }} - - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - version: "latest" + activate-environment: true enable-cache: true cache-suffix: ${{ matrix.python-version }} - cache-dependency-glob: | - pyproject.toml + python-version: ${{ matrix.python-version }} - name: Install package run: uv pip install '.[develop,test]' diff --git a/tests/test_cli.py b/tests/test_cli.py index bca5cb1..47fe7b0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -60,7 +60,12 @@ def test_cli_version(capfd): ) stdout = capfd.readouterr().out.strip() - assert stdout == __version__ + + # TODO: Accommodate PyPy as installed by `uv`, it emits spurious output on stdout before the version number. + # AssertionError: assert '(_common_types_metatype, 9088, 128, 128)\n(cython_function_or_method, 157568, 128, 128)\n3.6.0' == '3.6.0' + lines = [line.strip() for line in stdout.splitlines() if line.strip()] + assert lines, "Expected version output on stdout" + assert lines[-1] == __version__ def responder_build(path: Path, capfd: CaptureFixture) -> t.Tuple[str, str]: