Skip to content
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

specifying single-package indices with uv add --index #8341

Open
itrase opened this issue Oct 18, 2024 · 2 comments
Open

specifying single-package indices with uv add --index #8341

itrase opened this issue Oct 18, 2024 · 2 comments
Labels
question Asking for clarification or support

Comments

@itrase
Copy link

itrase commented Oct 18, 2024

The new --index functionality makes it possible to do this:
uv init
uv add torch --index pytorch=https://download.pytorch.org/whl/cu121
and get a reproducable toml file, which is really nice. Is there a way to specify through the command line that torch should be the only project that uses that index, and all the others should use the default (pypi)? As an example, if I then call:
uv add fsspec
This installs an old version present on the pytorch index, rather than the newer one in pypi. I could just add unsafe-best-match, but I'd prefer not to.
As an alternative, is there a way to tell uv that I want to install a particular package from the default index? Something like:
uv add fsspec --index default ? That doesn't feel quite as good but would probably be a solution 90% of the time.

@charliermarsh
Copy link
Member

You can change the index definition to:

[[tool.uv.index]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu121"
explicit = true

Then, the index will only be used by that package.

We don't have a way to do this via the CLI-only though, you have to add explicit = true to the TOML. I wonder what a good API would look like for that (--explicit-index)?

@charliermarsh charliermarsh added the question Asking for clarification or support label Oct 18, 2024
@itrase
Copy link
Author

itrase commented Oct 18, 2024

ah thank you! explicit solves the problem for now. And I think a CLI flag like --explicit-index would work totally fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

2 participants