-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Dependency-specific index urls #1560
Comments
Did you mean this? |
I don't think so, as that's specifying an exact artifact to fetch from rather than the registry to resolve the given dependency from. |
Oh, I understood. You need to specify a pypi source for certain modules. forgive my misunderstanding |
Just sharing my findings here if helpful. PDMPDM has a kinda nice way to approach this (falters if you want a project to support multiple PyTorch sources though): [project]
name = "example"
dependencies = [
"torch", # Implicitly resolves to `2.3.1+cu121` via configured PyTorch source below
"torchvision",
"torchaudio",
]
requires-python = ">=3.10"
[tool.pdm.resolution]
respect-source-order = true
[tool.pdm]
distribution = false
[[tool.pdm.source]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu121"
include_packages = ["torch", "torchvision", "torchaudio", "nvidia-*"] The That may be relevant context for you to keep in mind with your request to scope deps, as you may otherwise encounter that same caveat. They also have optional dependency groups: dependencies = [
"torchvision",
"torchaudio",
]
[project.optional-dependencies]
torch_cpu = ["torch==2.3.1+cpu"]
torch_cuda = ["torch==2.3.1+cu121"]
[[tool.pdm.source]]
name = "pytorch-cuda-12.1"
url = "https://download.pytorch.org/whl/cu121"
include_packages = ["torch_cuda", "torchvision", "torchaudio", "nvidia-*"]
[[tool.pdm.source]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
include_packages = ["torch_cpu", "torchvision", "torchaudio"] You'd then run a command to specify the optional dep as a group like If you don't specify the
Each would need to maintain separate lock files with PDM too. You could workaround the The With
|
Some packages like pytorch recommend installing their packages through custom index urls, e.g from that page:
Though we could use url prioritization (with uv to make it consistent) for this, it would be better in this case to support dependency-scoped index urls, to avoid leaking the extra index url check to every other dependency as well, which introduces an unexpected supply chain scope to all dependencies as well.
The text was updated successfully, but these errors were encountered: