Adding a package and pinning to a specific index by name only with uv add
#10140
Labels
enhancement
New feature or improvement to existing functionality
uv add
#10140
This issue is something of a followup to #6582, which was a duplicate of #171. That issue has comments #171 (comment) and #171 (comment) which seems to be the same thing I am interested in here (but I can't find anything in search that suggests those have been opened as independent issues yet).
Desired Behavior
Given an index definition named
my_artifactory
inpyproject.toml
:I would like to be able to run
uv add my-private-package --index my_artifactory
(or similar command - the important part here is that the CLI command references an index by name only, not by name and URL), with the resulting behavior that the package has been added and pinned to that specific index. Desired output inpyproject.toml
:Current Workaround
My current workaround is to add the
tool.uv.sources
entry first, manually in thepyproject.toml
file:Then I can run
uv add my-private-package
. But I would prefer not to be manually updatingpyproject.toml
for this - it would be nice to be able to do all "add/update dependency" tasks via theuv
CLI.Comparison to Poetry
I am trying to migrate from Poetry to uv. With Poetry, I can specify an explicit source in
pyproject.toml
:and add a dependency using
poetry add
with a--source my_artifactory
option, e.g.:The result of this command is a package that is pinned to that specific source:
I am hoping that the same behavior is possible with
uv
.The text was updated successfully, but these errors were encountered: