Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/workflows/mutation-mutmut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ on:
default: ""
python-version:
description: >-
Python version for uv. Must satisfy the caller project's
`requires-python`: the run step executes `uv run` inside the
caller's project, and setup-uv exports this as UV_PYTHON.
Python version for uv. Must be 3.13 or newer (the workflow's
helper scripts require >= 3.13, and setup-uv exports this as
UV_PYTHON for the whole job) AND must satisfy the caller
project's `requires-python`, because the run step executes
`uv run` inside the caller's project. Projects baselined
below 3.13 whose `requires-python` upper bound excludes 3.13
cannot use this workflow.
type: string
default: "3.13"

Expand All @@ -62,6 +66,19 @@ jobs:
contents: read
id-token: write
steps:
- name: Validate python-version
shell: bash
env:
PYTHON_VERSION: ${{ inputs.python-version }}
run: |
set -euo pipefail
lowest=$(printf '%s\n' "3.13" "${PYTHON_VERSION}" | sort -V | head -n 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject prefixed Python requests

When callers use uv-supported request forms that don't start with a digit, this guard silently accepts sub-3.13 interpreters: printf '3.13\ncpython3.12\n' | sort -V | head -1 returns 3.13 (same for <3.13/pypy3.12). uv documents <version-specifier> and <implementation><version> as valid request formats, and setup-uv sets this input as UV_PYTHON for later steps, so uv run --script ...mutation_detect_changes.py still fails later on the script's requires-python >=3.13 instead of producing the intended fast error.

Useful? React with 👍 / 👎.

if [[ "${lowest}" != "3.13" ]]; then
echo "python-version must be 3.13 or newer (got ${PYTHON_VERSION}):" \
"the workflow's helper scripts require >= 3.13." >&2
exit 1
fi

- name: Checkout caller repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
Expand Down
2 changes: 1 addition & 1 deletion docs/mutation-mutmut-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
| `mutmut-version` | pinned | Tool version; the results parser is validated against it. |
| `module-prefix-strip` | `src/` | Prefix removed before module-glob translation. |
| `extra-args` | (empty) | Extra `mutmut run` arguments (shell-lexed). |
| `python-version` | `3.13` | Python for uv; must satisfy the project's `requires-python` (e.g. set `"3.14"` for `>=3.14` projects). |
| `python-version` | `3.13` | Python for uv; must be **3.13 or newer** (the workflow's helper scripts require it — the job fails fast otherwise) and must satisfy the project's `requires-python` (e.g. set `"3.14"` for `>=3.14` projects). |

## Notes

Expand Down
Loading