mirror of
https://github.com/astral-sh/uv
synced 2026-01-21 13:30:11 -05:00
## Summary This is a prototype that I'm considering shipping under `--preview`, based on [`light-the-torch`](https://github.com/pmeier/light-the-torch). `light-the-torch` patches pip to pull PyTorch packages from the PyTorch indexes automatically. And, in particular, `light-the-torch` will query the installed CUDA drivers to determine which indexes are compatible with your system. This PR implements equivalent behavior under `--torch-backend auto`, though you can also set `--torch-backend cpu`, etc. for convenience. When enabled, the registry client will fetch from the appropriate PyTorch index when it sees a package from the PyTorch ecosystem (and ignore any other configured indexes, _unless_ the package is explicitly pinned to a different index). Right now, this is only implemented in the `uv pip` CLI, since it doesn't quite fit into the lockfile APIs given that it relies on feature detection on the currently-running machine. ## Test Plan On macOS, you can test this with (e.g.): ```shell UV_TORCH_BACKEND=auto UV_CUDA_DRIVER_VERSION=450.80.2 cargo run \ pip install torch --python-platform linux --python-version 3.12 ``` On a GPU-enabled EC2 machine: ```shell ubuntu@ip-172-31-47-149:~/uv$ UV_TORCH_BACKEND=auto cargo run pip install torch -v Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.31s Running `target/debug/uv pip install torch -v` DEBUG uv 0.6.6 (e95ca063b 2025-03-14) DEBUG Searching for default Python interpreter in virtual environments DEBUG Found `cpython-3.13.0-linux-x86_64-gnu` at `/home/ubuntu/uv/.venv/bin/python3` (virtual environment) DEBUG Using Python 3.13.0 environment at: .venv DEBUG Acquired lock for `.venv` DEBUG At least one requirement is not satisfied: torch warning: The `--torch-backend` setting is experimental and may change without warning. Pass `--preview` to disable this warning. DEBUG Detected CUDA driver version from `/sys/module/nvidia/version`: 550.144.3 ... ```
52 lines
1.5 KiB
TOML
52 lines
1.5 KiB
TOML
[package]
|
|
name = "uv-cli"
|
|
version = "0.0.1"
|
|
description = "The command line interface for the uv binary."
|
|
edition = { workspace = true }
|
|
rust-version = { workspace = true }
|
|
homepage = { workspace = true }
|
|
documentation = { workspace = true }
|
|
repository = { workspace = true }
|
|
authors = { workspace = true }
|
|
license = { workspace = true }
|
|
|
|
[lib]
|
|
doctest = false
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
uv-cache = { workspace = true, features = ["clap"] }
|
|
uv-configuration = { workspace = true, features = ["clap"] }
|
|
uv-distribution-types = { workspace = true }
|
|
uv-install-wheel = { workspace = true, features = ["clap"], default-features = false }
|
|
uv-normalize = { workspace = true }
|
|
uv-pep508 = { workspace = true }
|
|
uv-pypi-types = { workspace = true }
|
|
uv-python = { workspace = true, features = ["clap", "schemars"]}
|
|
uv-resolver = { workspace = true, features = ["clap"] }
|
|
uv-settings = { workspace = true, features = ["schemars"] }
|
|
uv-static = { workspace = true }
|
|
uv-torch = { workspace = true, features = ["clap"] }
|
|
uv-version = { workspace = true }
|
|
uv-warnings = { workspace = true }
|
|
|
|
anstream = { workspace = true }
|
|
anyhow = { workspace = true }
|
|
clap = { workspace = true, features = ["derive", "string"] }
|
|
clap_complete_command = { workspace = true }
|
|
serde = { workspace = true }
|
|
url = { workspace = true }
|
|
|
|
[dev-dependencies]
|
|
insta = { version = "1.40.0", features = ["filters", "json"] }
|
|
|
|
[features]
|
|
default = []
|
|
self-update = []
|
|
|
|
[build-dependencies]
|
|
uv-static = { workspace = true }
|
|
fs-err = { workspace = true }
|