Fix uv index: Use explicit=true for PyTorch index
- Added explicit=true to pytorch-cu121 index - Only torch, torchvision, torchaudio use PyTorch index - All other packages (requests, fastapi, etc.) use PyPI - Fixes: requests version conflict (PyTorch index has 2.28.1, we need >=2.31.0) How explicit=true works: - PyTorch index only checked for packages listed in tool.uv.sources - Prevents dependency confusion and version conflicts - Best practice for supplemental package indexes
This commit is contained in:
@@ -59,13 +59,18 @@ dev = [
|
|||||||
|
|
||||||
# Add PyTorch CUDA index as additional source
|
# Add PyTorch CUDA index as additional source
|
||||||
# CUDA builds work on both GPU and CPU systems (fallback to CPU if no GPU)
|
# CUDA builds work on both GPU and CPU systems (fallback to CPU if no GPU)
|
||||||
|
# Using 'explicit = true' means only packages we explicitly specify use this index
|
||||||
[[tool.uv.index]]
|
[[tool.uv.index]]
|
||||||
name = "pytorch-cu121"
|
name = "pytorch-cu121"
|
||||||
url = "https://download.pytorch.org/whl/cu121"
|
url = "https://download.pytorch.org/whl/cu121"
|
||||||
|
explicit = true
|
||||||
|
|
||||||
# Tell uv to get torch from the PyTorch CUDA index
|
# Tell uv to get torch, torchvision, and torchaudio from the PyTorch CUDA index
|
||||||
|
# All other packages come from PyPI
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
torch = { index = "pytorch-cu121" }
|
torch = { index = "pytorch-cu121" }
|
||||||
|
torchvision = { index = "pytorch-cu121" }
|
||||||
|
torchaudio = { index = "pytorch-cu121" }
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 100
|
line-length = 100
|
||||||
|
|||||||
Reference in New Issue
Block a user