Repository navigation
Recognize uv pip system installs in Dockerfile inputs - #625
Conversation
|
Thanks @kunalkshah1, this looks good overall: It touches the same parts of CI is green on this commit. #596 is a (Review assisted by Claude.) |
uv ignores a Requires-Python upper bound that makes pip refuse a pin (uv 0.13.1 installs sktime==0.20.0 on Python 3.13, pip finds no matching distribution), so a file read from RUN uv pip install was reported missing for a build that succeeds. Such files now go through the uv.lock policy (restore_uv_python_files), with the usual pip_refuses note. uv also picks the format of -r FILE by its name, so only *.txt and *.in files are read for uv. Docs mark the feature as after 0.13.0. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Thanks @kunalkshah1! The flag handling is right: only The issue itself was wrong on one point (it said to check the file as a pip requirements file), so we've made these changes:
One more change is coming before merge: an unpinned requirement under uv will be refused for now, since uv and pip can pick different versions for a range and wheelgap would be guessing. This one merges last of the four Dockerfile PRs, with main merged in, and gets its final review then. (Review assisted by Claude.) |
…t be pinned main gained -c FILE and harmless pip flags (wheelgap#622), verified includes (wheelgap#621), .dockerignore rules (wheelgap#626), install provenance (wheelgap#630), uv's Requires-Python lower-bound rule (wheelgap#623) and MCP wording (wheelgap#624) since this branch was written. _pip_install_files returns (files, constraints, prefer_binary, uv) and has one flag loop with the uv branch first. On a uv line only uv's own flags are read: --system, -r/--requirements, -c/--constraints, --no-cache, --no-cache-dir, --upgrade/-U and --quiet/-q (checked against `uv pip install --help`, 0.13.1). pip's --no-input, --root-user-action and --prefer-binary don't exist in uv, and --disable-pip-version-check only warns there, so they are refused. A uv line's files are found by the same copied_requirements closure as pip's, so the ignore rules and the include checks apply. Three things are uv's own: - every requirement must be pinned with == (through includes; a pin from a constraints file counts), using the gate --prefer-binary already had, and --deps is refused: wheelgap resolves a range as pip does, and uv can pick another release; - a -r inside a constraints file is refused: pip installs what it names and uv only constrains with it (uv 0.13.1 against pip 26.2); - included and -c files must be named *.txt or *.in, like the -r file. A file installed by pip on one line and uv on another is refused, and a caller that doesn't pass uv_installs gets an error rather than pip's answer. cli.py: the stderr note keeps main's list of every file read and says which installer ran; uv-installed files get restore_uv_python_files, as a uv.lock with --online does, so the pip_refuses note is main's. docs/cli.md has one paragraph for uv; CHANGELOG keeps every bullet once, this PR's first, reworded. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The requirements reader follows pip for option lines inside a file, and uv reads them by its own rules: with --extra-index-url uv takes the first index that has the package where pip takes the best file of them all, and --no-binary / --only-binary combine differently (uv 0.13.9). A uv-installed file with such a line got pip's answer. Every file a uv line reads (the -r file, the RUN line's -c file, and every file they include) may now hold only requirements and plain `-r FILE` / `-c FILE` lines; any other option line is an error naming the option and the file, never its value, so an index URL with credentials isn't echoed. A requirement with its own --hash is not an option line and is still read. pip lines are unchanged. The refusal for a COPY that brings a uv.toml or pyproject.toml before a uv line now says what to do about it. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Merged, thanks @kunalkshah1! That is all four of your Dockerfile PRs in, combined: pip flags and The issue was wrong to say a uv-installed file should be checked as pip would, so this one changed the most before merge. Each point was tested with real uv and pip:
(Reply assisted by Claude.) |
Closes #596
What this changes
Read uv pip install --system for requirements-file inputs, with the two cache flags, and identify uv in the RUN diagnostic. Recognize the documented external COPY of the uv and optional uvx binaries. Refuse unsupported flags and potentially active uv configuration files.
Tests compare the Dockerfile and direct requirements reports, exercise both binary destinations and verify line-specific refusals. All four new parity cases fail on the original source.
AI tools used: Codex
Ruff formatting and lint, mypy, and full pytest on macOS with Python 3.14 (5,188 passed, 3 skipped). The Unreleased entry will be added with the PR number.