From 3e34aee63efb8b20eb035ba32706a18e7babae00 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Fri, 22 Aug 2025 12:06:23 +0100 Subject: [PATCH] Avoid introducing unnecessary system dependency on CUDA (#15449) ## Summary Packages like `triton` should come from the PyTorch index, but they don't actually vary across (e.g.) the `cu128` or `cu129` indexes. Closes https://github.com/astral-sh/uv/issues/15446. ## Test Plan Validate that the following pins to `cu128`, rather than `cpu`: ``` echo "vllm\ntorch==2.7.1+cu128" | cargo run pip compile --torch-backend=auto --extra-index-url https://wheels.vllm.ai/b2f6c247a9b84556a8ea0e75bb4a2db765ff3315 - --python-platform linux --python-version 3.13 -v ``` --- crates/uv-resolver/src/resolver/mod.rs | 1 + crates/uv-torch/src/backend.rs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/crates/uv-resolver/src/resolver/mod.rs b/crates/uv-resolver/src/resolver/mod.rs index d0f43e9c9..92f9fba38 100644 --- a/crates/uv-resolver/src/resolver/mod.rs +++ b/crates/uv-resolver/src/resolver/mod.rs @@ -1839,6 +1839,7 @@ impl ResolverState bool { + matches!( + package_name.as_str(), + "torch" + | "torcharrow" + | "torchaudio" + | "torchcsprng" + | "torchdata" + | "torchdistx" + | "torchtext" + | "torchvision" + ) + } + /// Return the appropriate index URLs for the given [`TorchStrategy`]. pub fn index_urls(&self) -> impl Iterator { match self {