Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

uv ignores python_version input, silently selects newest Python #151

Closed

Description

@tykeal

Summary

The python_version input is documented as "Python version to use for SBOM
generation", but it has no effect on which interpreter uv actually uses.

For uv-managed projects whose requires-python floor is above the action's
default, uv silently discards the configured interpreter, downloads the newest
Python that satisfies requires-python, and then builds dependencies from
source because no wheels exist yet for that brand-new version. This can run for
many minutes and hit the caller's job timeout.

Evidence (action source at ref a849d7190403165d437f2b8d29bc17a4894728f7)

  • lines 13-16 — input python_version, required: false, default: "3.12":
  python_version:
    description: "Python version to use for SBOM generation"
    required: false
    default: "3.12"
  • lines 214-216 — actions/setup-python@v7 is given that input:
    - name: "Setup Python"
      uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
      with:
        python-version: ${{ inputs.python_version }}
  • line 342 — dependency install:
install_cmd=(uv sync --locked)
  • line 517 — command prefix, later used as
    uv run cyclonedx-py environment --pyproject pyproject.toml ...:
CMD_PREFIX="uv run"

Nothing binds uv to the interpreter installed by setup-python. There is no
--python flag, no UV_PYTHON environment variable, and no uv python pin
anywhere in the action. uv therefore performs its own interpreter resolution
from the project's requires-python, and per the uv documentation it will
automatically download a Python version when none on the system satisfies the
request:

https://docs.astral.sh/uv/concepts/python-versions/

Observed failure

Repository tykeal/homeassistant-rental-control, release workflow run
38915340624, job Generate SBOM, 2026-10-16.

  • The project declares requires-python = ">=3.14.2" in pyproject.toml and
    has a uv.lock.
  • The caller did not pass python_version, so the action's 3.12 default was
    used for setup-python.
  • 3.12 does not satisfy >=3.14.2, so uv ignored it. Log at 14:25:17:
Downloading cpython-3.15.0-linux-x86_64-gnu (download) (35.9MiB)
  • Python 3.15.0 had only just been released, so C-extension dependencies had no
    wheels. The job spent the remaining time compiling from source; the processes
    reaped at kill time were uv, python, and multiple c++ / cc1plus.
  • The job ran 14:25:03 -> 14:35:21 (10m18s) and was terminated by the caller's
    timeout-minutes: 10. GitHub reports a timed-out job as cancelled, which
    obscured the real cause. The downstream Grype job was skipped via needs:.

Why this is likely to affect others

A default of 3.12 is below the requires-python floor of a growing number of
projects, so the silent-override path is the common case rather than an edge
case. When it triggers, uv selects the newest satisfying interpreter —
precisely the version least likely to have prebuilt wheels available.

Projects with an unbounded requires-python (very common) effectively get
"whatever Python was released most recently" on every run, so a green pipeline
can start failing with no change at all on the consumer side.

Suggested remedies

Offered as options, not as a decided design:

  1. Bind uv to the configured interpreter — e.g. export
    UV_PYTHON: ${{ inputs.python_version }} for the uv steps, or pass
    --python.
  2. Alternatively/additionally, after resolution, detect that the interpreter uv
    selected differs from inputs.python_version and fail fast with a clear
    message rather than silently proceeding into a long source build.
  3. Consider documenting that python_version is advisory for uv projects until
    (1) lands.

Happy to raise a PR for whichever approach the maintainers prefer.

Activity

  1. added
    bug
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions