Skip to content

--dockerfile-inputs: read RUN uv pip install --system -r FILE #596

Closed

Description

@patrickballard

--dockerfile-inputs reads RUN pip install -r FILE only. Images that install with uv get an error:

FROM python:3.14-slim
COPY --from=ghcr.io/astral-sh/uv:0.13.9 /uv /uvx /bin/
WORKDIR /app
COPY requirements.txt .
RUN uv pip install --system --no-cache -r requirements.txt
$ wheelgap --dockerfile Dockerfile --dockerfile-inputs
wheelgap: error: Dockerfile:5: only `RUN pip install -r FILE` and system package commands (apt-get, apk, dnf...) are read by --dockerfile-inputs, and this RUN may change what pip installs

The COPY --from on line 2 is refused as well (_read_copy() reads only --chown, --chmod and --link). This is one of the steps left from #496.

Where

src/wheelgap/dockerfile.py: _pip_install_files() decides what a RUN installs, and _read_copy() refuses every COPY --from.

What to do

  • Read uv pip install --system -r FILE (one or more -r FILE), with --no-cache and --no-cache-dir ignored. --system is required: without it uv installs into a virtual environment, and which one depends on things wheelgap doesn't read. Refuse every other uv flag with its line, as pip flags are refused.
  • Read one COPY --from: the documented way to get uv into an image, COPY --from=ghcr.io/astral-sh/uv[:TAG][@DIGEST] /uv [/uvx] DEST/. It copies only those binaries, so it can't bring in a requirements file or a pip config. Any other COPY --from keeps today's error.
  • uv reads its own settings. Treat a uv.toml or a pyproject.toml copied into the image, and an ENV/ARG that sets UV_ variables, as today's code treats a pip config file: an error naming the line, because they may change what uv installs. (UV_ variables are refused already.)
  • The file is checked as a requirements file is today. Say in the stderr note which installer the line used (Dockerfile:5: RUN uv pip install -r reads requirements.txt).
  • Later: uv pip install of plain requirement arguments, and uv sync (its own issue).

Done when:

  • Tests in tests/test_dockerfile.py cover: the form above; uv pip install without --system (refused); another uv flag (refused); COPY --from of the uv binaries to /bin/ and /usr/local/bin/; a COPY --from of anything else (refused, as now); a copied uv.toml (refused).
  • The rows for the Dockerfile above equal the rows of wheelgap requirements.txt with the image's Python and platform.
  • docs/cli.md says what is read. A CHANGELOG line goes under ## Unreleased.

Activity

  1. added
    enhancement
    help wanted
    on Nov 21, 2026
  2. kunalkshah1 commented on Nov 21, 2026

    @kunalkshah1
    Contributor

    I opened #625. The regression tests check the documented uv binary COPY into both /bin/ and /usr/local/bin/, and compare the resulting report with a direct requirements check.

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

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions