Skip to content

Studio: keep the extras install working under a hardened uv.toml / pip.conf - #8579

Merged
danielhanchen merged 5 commits into
mainfrom
fix-hardened-pm-config
Aug 12, 2026
Merged

danielhanchen merged 5 commits into
mainfrom
fix-hardened-pm-config

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Fixes #8530.

The problem

Studio would not install on a machine carrying security-hardened package-manager config. The reporter had the docker/safe-defaults uv.toml plus a matching pip.conf:

# ~/.config/uv/uv.toml
no-build = true            # equivalent to `uv --no-build`
exclude-newer = "3 days"
python-downloads = "never"
# ~/.config/pip/pip.conf
[global]
only-binary = :all:
require-hashes = true
require-virtualenv = true

The install died at unsloth extras:

× No solution found when resolving dependencies:
╰─▶ Because openai-whisper==20250625 has no usable wheels and you require
    openai-whisper==20250625, we can conclude that your requirements are unsatisfiable.

    hint: Wheels are required for `openai-whisper` because building from source is
    disabled for all packages (i.e., with `--no-build`)

  uv failed, falling back to pip...
ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==

Two independent causes:

  1. studio/backend/requirements/extras.txt carries requirements that ship no wheel on PyPI at any version: openai-whisper==20250625, argbind==0.3.9, randomname==0.2.1, plus antlr4-python3-runtime==4.9.3, which arrives transitively because omegaconf==2.3.1 pins it below the 4.13.2 wheel. no-build = true makes all four unresolvable. These are not an accident: they are already audited and allowlisted for source builds by the nobuild contract in .github/scripts/clean-machine-assert.sh and .github/scripts/assert-nobuild.ps1.
  2. The pip fallback then inherited require-hashes = true, which no requirements file we ship can satisfy, since they are pinned but unhashed.

_install_env_for_cmd() only neutralises ambient config for commands that pin an index, and the extras install pins nothing, so it inherited both.

The fix

Package-scoped --no-binary for the four wheel-less requirements. Verified against uv 0.10 and pip 26 that --no-binary openai-whisper resolves under both no-build = true and only-binary = :all:, while every other requirement still comes from a wheel. Dropping a name from the flags makes that name refused again, so the exemption really is per-package. A blanket --no-build / --no-binary :none: override would have thrown the user's binary policy away wholesale, on exactly the kind of machine where an unexpected source build is most likely to fail.

PIP_REQUIRE_HASHES=0 in the child environment of the installer's own pip commands. Hash-required mode has no command-line negation, so this is the one knob that has to go through the environment. pip applies environment variables after config files, so pip.conf's index-url, trusted-host, cert and proxy all stay in force. It is scoped to commands this module runs, never uv commands, and never written to os.environ, so a user's own later pip commands keep their policy. require-virtualenv is deliberately left alone: the fallback already runs the venv interpreter, so it is satisfied.

Pinned-index installs additionally drop the restrictive UV_* / PIP_* variables. That branch already neutralised the config files, but an environment variable outranks a config file, so a hardened shell could still fail a torch repair the pin was supposed to make deterministic.

What is deliberately not changed: a non-pinned install still inherits the user's index and mirror configuration, exactly as before. test_non_pinned_install_keeps_user_mirror and test_non_pinned_cmd_keeps_uv_config_discovery pass unmodified, and all 40 pre-existing tests in that file are untouched.

Verification

Reproduced end to end against the reporter's exact config, using a throwaway XDG_CONFIG_HOME:

before after
uv pip install -r extras.txt fails on openai-whisper no usable wheels resolves the full manifest
pip fallback ERROR: In --require-hashes mode... resolves the full manifest
argbind with its flag removed n/a still refused, so the user's no-build still applies

13 new tests in tests/python/test_install_python_stack.py covering the flag construction for both uv and pip, the extras call site actually passing them, drift between the constant and the two CI nobuild allowlists, the relaxation applying to pip but not uv, non-install commands staying untouched, os.environ never being mutated, and the real uv-fails-then-pip fallback carrying both. Each was mutation-checked: reverting any part of the fix fails them.

tests/studio/test_xpu_triton_swap.py needed a two-line update. It execs a source slice of _install_env_for_cmd into a namespace built by hand, and names resolve there at call time, so a helper missing from that namespace only surfaces as a NameError once a test invokes the scrub. Both new names are now extracted from the module rather than stubbed, keeping that test's "the module's own code, not a re-implementation" property.

Full tests/python/ + tests/studio/ run: 4140 passed, failure set identical to main apart from tests that are environment dependent on both (a live-server class that returns HTTP 401 here, and 8 pre-existing errors in test_chat_thread_title_cas.py).

Left for follow-ups

  • exclude-newer = "3 days" selected unsloth 2026.8.9 rather than the newest release, so a freshly published fix stays hidden for three days. Non-fatal, and a package-scoped --exclude-newer-package exemption wants a uv version-floor check first (UV_MIN_VERSION="0.9.3").
  • An ambient no-deps, dry-run, target or exact can make an install exit 0 with an incomplete or misdirected venv, which is a quieter failure than this one. pip check's result is currently discarded.
  • install_wheel() in studio/backend/utils/wheel_utils.py and mlx_repair.py build their own child env and so still inherit require-hashes for direct-URL wheel installs.
  • uv's own [pip] require-hashes key has no command-line negation either, so it would need config-file surgery; it was not part of this report.

danielhanchen and others added 2 commits August 12, 2026 14:40
…p.conf

A machine with security-hardened package-manager config could not install
Studio. With `no-build = true` in ~/.config/uv/uv.toml, the "unsloth extras"
step failed because extras.txt carries requirements that ship no wheel on PyPI
at any version, and uv correctly refused to build them:

    x No solution found when resolving dependencies:
    `-> Because openai-whisper==20250625 has no usable wheels [...]
        hint: building from source is disabled for all packages (--no-build)

The pip fallback then hit `require-hashes = true` in ~/.config/pip/pip.conf and
rejected every requirement, since the shipped requirements files are pinned but
unhashed.

The wheel-less requirements are already audited and allowlisted for source
builds in .github/scripts/clean-machine-assert.sh, so the installer now names
them explicitly with a package-scoped --no-binary. That overrides a global
no-build / only-binary policy for those four names only, and leaves the user's
binary-only policy in force for every other requirement. A blanket --no-build
or `--no-binary :none:` override would have discarded the policy entirely.

Hash-required mode has no command-line equivalent, so it is switched off in the
child environment of the installer's own pip commands. pip applies environment
variables after config files, so index-url, trusted-host, cert and proxy
settings from pip.conf all stay in force, and uv commands are untouched. The
override never reaches os.environ, so the user's own later pip commands keep
their policy.

Pinned-index installs additionally drop the restrictive UV_* / PIP_* variables.
That branch already neutralised the config files, but an environment variable
outranks a config file, so a hardened shell could still fail a torch repair the
pin was supposed to make deterministic.

Fixes #8530
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Two paths still aborted under a user-level `no-build = true` once the extras
step was fixed.

The pinned Diffusers revision is a source ARCHIVE, and uv refuses to build one
under no-build ("Building source distributions for `diffusers` is disabled"),
so a hardened host died at "diffusers pin" instead. That step runs on every
platform for python >= 3.10, which includes the macOS host in the report. The
exemption is guarded on the version marker because python < 3.10 resolves a
released wheel from diffusers-pin.txt that must not be forced through a source
build.

extras.txt pins MeCab==0.996.5 on macOS cp314 and up, the last release carrying
an sdist, so no-build refuses it there too. MeCab is a C extension, so the
exemption is conditional: every other host resolves 0.996.13 from a wheel and
must not be pushed into a compiler-dependent build.

Verified against uv 0.10 with a cold cache, which matters here: a warm cache
reuses the wheel it already built for the archive and hides the failure.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: fa23315246

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

Review round 1 outcome

Both Codex items were correct and are fixed in 0a73153. Recording the reasoning here since the settled threads get pruned.

Carry exemptions into later source-only installs (P1) -- fixed, with one half rejected.

Re-checked both later source-only installs against uv 0.10 with a COLD cache, which turned out to be the decisive detail: a warm cache reuses the wheel it already built for a source archive, so the failure silently disappears and the first check comes back green.

  • diffusers-pin.txt is a source ARCHIVE. With the cache cleared, uv refuses it outright: Failed to download and build ... Building source distributions for diffusers is disabled. That step runs on every platform for python >= 3.10, so it is exactly where the macOS host in [Bug] Install failed #8530 would have died next. Now exempted, guarded on the version marker because python < 3.10 resolves a released wheel from that file which must not be forced through a source build.
  • triton-kernels.txt I could not reproduce, so no flag was added. It is a git+https requirement, and uv resolves and installs it fine under no-build = true (a source tree is not a source distribution). pip's only-binary = :all: does not reach a direct URL or VCS requirement either. Adding an exemption there would have been a no-op that implied a constraint that does not exist.

Exempt the macOS MeCab source distribution (P2) -- fixed.

Confirmed against uv 0.10 targeting macOS cp314: MeCab==0.996.5 is refused under no-build = true and resolves with --no-binary MeCab. The exemption is conditional on IS_MACOS and sys.version_info >= (3, 14) rather than unconditional, because MeCab is a C extension and every other host resolves 0.996.13 from a wheel; exempting it everywhere would force a compiler-dependent build on hosts that never needed one.

Caveat worth recording: this does not by itself make macOS cp314 installable under no-build. Resolving extras.txt for that target now stops on scikit-learn==1.7.1, which has no cp314 wheel on Linux either, so that is a pre-existing platform-wide gap that closes when upstream ships cp314 wheels, not something a package-scoped exemption should paper over. MeCab is different in kind: the repo deliberately pins the last sdist-carrying release there.

End-to-end check on the reporter's actual platform. Resolving extras.txt for macOS arm64 cp313 under their exact uv.toml fails on openai-whisper without the fix and resolves completely with it.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@danielhanchen
danielhanchen merged commit 88262f5 into main Aug 12, 2026
69 of 78 checks passed
@danielhanchen
danielhanchen deleted the fix-hardened-pm-config branch August 12, 2026 16:46
danielhanchen added a commit that referenced this pull request Sep 15, 2026
…10902)

* Studio: keep the operator's package-manager policy in the installer

#8579 made the installer's own pip and uv commands survive a hardened
uv.toml / pip.conf, but it did that with a blanket amnesty: every pinned
install dropped no-build, only-binary and exclude-newer from the
environment and ran with PIP_CONFIG_FILE at devnull and UV_NO_CONFIG=1,
so the operator's build-time code execution controls went with it.

Narrow that to the one thing the installer actually cannot satisfy.

* Hash enforcement (PIP_REQUIRE_HASHES / UV_REQUIRE_HASHES) is still
  cleared: every requirements file we ship is pinned but unhashed, so
  require-hashes has no artifact to check and can only abort the install.
* no-binary is still cleared for pinned commands, because it would FORCE
  a source build of a wheel the pin exists to fetch. That is less
  build-time execution, not more.
* UV_NO_BUILD, UV_NO_BUILD_PACKAGE, PIP_ONLY_BINARY and UV_EXCLUDE_NEWER
  are now left in force. Every pinned index we install from serves
  wheels, so honouring them costs the pin nothing.
* PIP_CONFIG_FILE points at a rewrite of pip's own config minus the four
  source keys (the existing _pip_config_without_sources) instead of
  devnull, so cert, proxy, trusted-host and only-binary survive while the
  pin still gets the index determinism it needed. Computed once per run.
* UV_NO_CONFIG=1 has to stay (uv has no per-key override and a discovered
  uv.toml outranks the CLI pin), so a no-build in that file is read back
  and re-asserted as UV_NO_BUILD=1 rather than silently lost.
* The hash relaxation is keyed on the pip SUBCOMMAND now, not on the word
  "install" appearing somewhere in argv.

Measured against a real pip.conf carrying require-hashes, only-binary,
no-index and cert: raw pip refuses the install, the installer path
installs the wheel, the installer path REFUSES the same package when only
an sdist is available, and a pinned --index-url install succeeds with
cert and only-binary intact.

The package-scoped --no-binary exemptions for the four audited wheel-less
requirements and the diffusers source archive are unchanged; they are
what keeps #8530 fixed.

* Keep the pin deterministic: devnull, then put the policy back key by key

Simulation caught a real regression in the first pass of this branch. Pointing
PIP_CONFIG_FILE at a rewritten config does NOT suppress a SITE or GLOBAL
pip.conf: pip documents, and pip 26.2 confirms, that naming an existing file
skips the per-user file only, while os.devnull is what "disables the loading of
all configuration files". So a venv-level or /etc-level `no-index` came back to
life and killed the pinned install:

  pip install --index-url <pin> packaging==24.0   ->  No matching distribution

That would have broken every torch repair, the XPU triton fetch and the torchao
pin on any host with a site or global pip.conf. Reverted to os.devnull and put
the operator's settings back one key at a time instead:

* _pinned_pip_config_overrides() reads `pip config list` once per run and
  re-asserts an ALLOWLIST as PIP_ environment variables: cert, client-cert,
  proxy, trusted-host, timeout, retries, keyring-provider and only-binary. The
  transport half also fixes a pre-existing bug, since devnull used to drop the
  CA and proxy a private index needs.
* index-url, extra-index-url, find-links and no-index are never re-asserted
  (the pin replaces them), nor is no-binary (it would force a source build of a
  pinned wheel), nor require-hashes (unsatisfiable against unhashed
  requirements).
* Only global/install/download/wheel sections are read, so a `list.format` does
  not become a global PIP_ variable, and `:env:` rows are skipped so the child
  cannot re-inherit the variables the scrub just cleared.

Also dropped the uv side of the previous commit. Measured against uv 0.10.7,
UV_NO_BUILD, UV_NO_BINARY and UV_ONLY_BINARY are not uv environment variables at
all: uv reads no-build from its config file, and re-asserting the variable was
dead code promising a guarantee uv does not honour. UV_EXCLUDE_NEWER and
UV_REQUIRE_HASHES are real and are handled as before. A uv.toml no-build still
applies to every non-pinned command, which is where source builds actually
happen.

_executable_stem() splits on both separators, so a Windows argv0 is recognised
off-Windows too, and a degenerate command can no longer raise out of the
subcommand test.

Verified: 78 of 90 base-vs-head environment comparisons are byte-identical and
the other 12 are the intended hardened-host cases; real installs across
pip 21.3.1 to 26.2.1 and Python 3.9 to 3.13; a site-config no-index no longer
breaks a pinned install while only-binary still refuses an sdist.

* Make the config read unable to fail the install, and the tests hermetic

Three defects found reviewing the previous commit, all in code this branch
introduced.

The `pip config list` read sits on the path to every pinned install, including
the final torch repair, so it must degrade to "no overrides" for ANY unexpected
answer and not just for a missing pip. It caught OSError and TimeoutExpired but
would have propagated anything else: a listing that is not bytes, a stdout of
None, a decode that raises. Parsing moved into _parse_pinned_pip_config() and
the whole read is now wrapped, with cases for each shape.

A command section now beats `global` for the same option, which is pip's own
precedence. It previously depended on the order `pip config list` happened to
print the two lines in, so `global.only-binary=:all:` plus
`install.only-binary=numpy` resolved differently run to run.

The tests were not hermetic. A CI image carrying its own /etc/pip.conf would
have leaked into the pinned-env assertions, and a test that mocks subprocess
could populate the memoised read with a Mock and poison whatever ran next under
random ordering. An autouse fixture clears the cache around every test and stubs
the read, with an opt-out marker for the few tests that drive it themselves.
Verified by running the three files repeatedly under random ordering.

* Fix eight defects found reviewing this branch

All eight are in code this branch introduced.

The exec-extraction in tests/studio/test_xpu_triton_swap.py stopped pulling the
parser once it was split out, so the "real scrub" that file deliberately
executes raised NameError into a broad except and returned {} for every case:
the file still reported 62 passed while asserting nothing. The loader now
executes the extracted parser once against a known listing, so an inert
extraction fails loudly instead of agreeing with everything.

That mask was the second defect. The read caught OSError and TimeoutExpired
around the subprocess but then wrapped the parse in `except Exception`, turning
any programming error into "this operator has no pip config", which on a
corporate host is a silent loss of cert, proxy and trusted-host on every pinned
install. Narrowed to (OSError, subprocess.SubprocessError) around the call, with
the parser skipping unparseable lines as before.

Section precedence let [wheel] and [download] overwrite [install], which is not
"more specific", it is a different subcommand: an operator with
`[install] only-binary = :all:` and `[wheel] only-binary = numpy` had their
install-wide policy downgraded to one package. Only [global] and [install] are
read now, install winning, since the PIP_ variable is command-wide anyway.

The memoisation cached failures as well as successes, so one transient miss (the
60s timeout, or a read racing the pip bootstrap) cost the operator their
transport settings for the rest of the run. Only a successful read is cached.

Value joining applied one rule to keys with two. `cert` is a single value, and
collapsing whitespace turned `C:\Program  Files\ca.pem` into a path that does
not exist; `only-binary` is comma separated, so a two-package value became one
bogus name and the policy silently stopped applying. Measured against pip 26.2:
PIP_ONLY_BINARY="a,b" refuses both as sdists, PIP_TRUSTED_HOST="a b" is
accepted, and `pip config list` renders a multi-value setting on one line with
an escaped \n.

The subcommand scan skipped leading-dash tokens but not the VALUE of a global
option that takes one, so `pip --cache-dir /tmp/c install x` read as not an
install and would have lost the hash relaxation. It now looks for the first
token that names a pip subcommand.

UV_EXCLUDE_NEWER goes back to being cleared for pinned commands, which is the
pre-existing behaviour. Only uv reads it, _build_pip_cmd never adds pip's
--uploaded-prior-to, and pip_install falls back to pip whenever uv fails, so
honouring it on the uv leg alone means a pinned install that fell back quietly
installs an artifact the cutoff forbids.

And a dead REAL_PINNED_PIP_CONFIG_OVERRIDES assignment that read as if it were
the fixture's restore mechanism is gone.

Suites: 10768 passed. The 2 torchcodec failures reproduce on unmodified main.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Tighten the comments this branch added

Comment and docstring lines in the diff: 178 to 105. Every measured fact is
kept, in one line where it took four: the devnull suppression rule, the pip
26.2 and uv 0.10.7 measurements, the separator each config key is read with,
and the NameError trap in the exec-extraction. AST-gated comment-only.

* Read the pip config section that belongs to the command being run

pip config is per subcommand, and the re-assertion was reading [install] for
every pinned command. Measured on pip 26.2: a pip.conf carrying
[download] no-index stops a pip download and leaves pip install untouched, so
translating [install] onto _ensure_xpu_triton's pinned pip download both drops
that command's own cert, proxy and trusted-host and imposes an install-only
policy on it.

_pinned_pip_config_overrides() now takes the subcommand and reads [global] plus
that command's section, with the command section winning. _pip_subcommand_of()
resolves it from the command; a uv command defaults to install, since the PIP_
variables only ever reach its pip fallback. The listing is memoised instead of
the parsed result, so this still costs one subprocess per run.

Suites pass, and the real-pip, audit, differential and old-pip simulations are
unchanged: 27/27, 15/15, 78 identical environments with 12 intended, 30/30.

* Accumulate repeatable pip options, and do not read an empty env value as set

Two ways the re-assertion could still lose the operator's policy, and one test
that could pass for the wrong reason.

pip ACCUMULATES a repeatable option across sections rather than letting the
command section replace the global one. Measured on pip 26.2: a pip.conf with
[global] only-binary = :all: plus [install] only-binary = numpy still refuses an
unrelated sdist, so emitting PIP_ONLY_BINARY=numpy dropped the :all: policy on
every pinned install. List keys now accumulate global plus the command section,
deduplicated, with the separator each key is read with; scalars still take the
command section alone, since two certs cannot be concatenated. Verified end to
end: that config now yields PIP_ONLY_BINARY=':all:,numpy' and a pinned sdist
install is refused.

An empty inherited value is no longer treated as an override. pip ignores an
empty environment value and falls through to the config file, which the pinned
branch has just removed with devnull, so PIP_CERT= in the parent environment
left the child with neither and a private index unreachable. Confirmed with
env_var:
  PIP_CACHE_DIR='/mnt/disks/unslothai/daniel1/.cache/pip'
env:
global:
  /etc/xdg/pip/pip.conf, exists: False
  /etc/pip.conf, exists: False
site:
  /mnt/disks/unslothai/daniel1/workspace_1/pip.conf, exists: False
user:
  /home/daniel1/.pip/pip.conf, exists: False
  /home/daniel1/.config/pip/pip.conf, exists: False: PIP_TIMEOUT='' shows the variable and then uses
global.timeout from the file. A whitespace value is left alone; that is a value
pip would use, not ours to second-guess.

The download-section test now clears PIP_CERT: the caller's environment
legitimately wins over the re-assertion, so on a host that exports one the test
asserted on the ambient value.

* Keep the order of a repeatable option instead of deduplicating it

pip applies a repeatable option IN ORDER, and :none: empties the set, so a
re-add after a reset has to survive. Deduplicating dropped it: with
[global] only-binary = a,b and [install] only-binary = :none:,a the parser
emitted a,b,:none:, which ends on the reset and allows exactly the sdist build
the operator forbade.

Measured on pip 26.2 against a venv pip.conf carrying that config: pip itself
refuses the sdist, the deduplicated string allows it, and the order-preserving
concatenation refuses it again. End to end, the installer and pip with its own
config now return the same exit code for the same install.

* Give trusted-host section precedence instead of accumulating it

pip's own parser, asked with [global] and [install] both set, resolves
trusted_hosts to the install value alone (an append option, assigned per
section) while format_control holds both (a callback that mutates in
place). Accumulating trusted-host re-trusted a host the install section
had dropped, which is a TLS decision, so the two keys are now separated:
_PINNED_PIP_CONFIG_SEPARATORS says how a value is spelled in the
environment, _PINNED_PIP_CONFIG_ACCUMULATING says which key carries
across sections, and only only-binary is in it.

* Make both files a fixed point of the formatting hook

Backend CI's formatter fixed point check was failing on this branch. One
of the two files is mine: ruff 0.15 formats the new parser differently
from the 0.6.9 the hook pins, so what I committed was not what the hook
produces. The other, tests/python/test_docker_nvidia_toolkit_install.py,
is pre-existing drift that reached main in #10623 and is exactly the
case that test was written to catch; it is untouched by this branch
otherwise, and the change here is the hook's own output.

* Decode pip config output with the encoding the child wrote

A piped child encodes stdout with its own locale encoding, which on
Windows is the ANSI code page rather than UTF-8, so the unconditional
UTF-8 decode corrupted a cert or client-cert path spelled with non-ASCII
characters. That is worse than losing the setting: the corrupted path
exists nowhere, so pip fails the pinned install outright on exactly the
corporate host the allowlist exists to serve. UTF-8 is still tried
first and strictly, so the POSIX case and Windows UTF-8 mode are
unchanged; the locale codec is the fallback.

* Enforce the restored only-binary on the uv leg, and dictate the read encoding

Two gaps the review found. uv reads neither pip.conf nor
PIP_ONLY_BINARY, and a pinned command runs with UV_NO_CONFIG=1 because a
discovered uv.toml outranks the CLI pin (#6898), so restoring the policy
in the environment alone left the leg that actually runs free to build a
source distribution the operator had forbidden. Measured against uv
0.10.7: a pinned uv install builds the sdist with PIP_ONLY_BINARY=:all:
set, and refuses it given --only-binary. _build_uv_cmd now translates
the restored value into uv flags for pinned commands only, since a
non-pinned one keeps its config file and uv applies the policy itself.

Second, UTF-8 first was not a reliable encoding detector: cp1252 bytes
can form valid UTF-8, so a mis-encoded cert path could decode cleanly
into the wrong path. The read now dictates PYTHONIOENCODING=utf-8 rather
than sniffing what the child wrote, at both call sites that read pip
config, and the locale decode stays only as a fallback.

* Tighten the comments added by this branch

Comment and docstring text only, with no code change: the AST gate
confirms it. Ten lines out, mostly from the two longest measurement
notes, with each measured fact kept.

* Single-source the uv policy flag, and bound what a wedged pip can cost

Three findings from an independent audit of this branch.

_build_uv_cmd asked for the pip config separately from _install_env_for_cmd,
so if the first read failed and the second succeeded the uv command went
out without --only-binary while its own environment carried
PIP_ONLY_BINARY. The flag now comes off the env that very command will
run with, so the two cannot disagree.

The 60s timeout was per attempt and unbounded across the run, because
failures are deliberately not memoised. A wedged pip therefore paid it
once per pinned command. A HANG is now budgeted, twice at 30s for the
whole run, which is what the comment always claimed.

Budgeting every failure would have been wrong in the other direction: a
fresh venv has no pip for the first part of the run, that answer is
instant, and spending the budget on it would lose the operator's cert
the moment pip appeared. Cheap failures stay freely retryable, with a
test for each direction.

* Tighten the comments added by the audit fixes

Comment text only, no code change; the AST gate confirms it.

* Derive uv's only-binary flags from the same config read as its environment

* Exempt the sdist-only rocm package from the only-binary a pinned install re-asserts

* Add an exported only-binary to the configured one instead of replacing it

* Limit the rocm exemption to AMD per-arch index pins

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: oobabooga <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Install failed

1 participant