-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow users to specify a custom source package to uv tool run
#3677
Conversation
crates/uv/src/cli.rs
Outdated
// TODO(zanieb): Consider using `Vec<String>` instead, treating the first as the target package | ||
/// Use the given package specification instead of inferring it from the target command. | ||
#[arg(long)] | ||
pub(crate) package: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open to some bike-shedding here.
pipx says
--spec SPEC
The package name or specific installation source passed to pip. Runs
pip install -U SPEC
. For
example--spec mypackage==2.0.0
or--spec git+https://github.com/user/repo.git@branch
which I find very unintuitive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. package
isn't bad but it might be confusing with -p
in the workspace API. I find spec
okay but don't feel strongly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like -p
being short for --python
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I was assuming -p
would be short for package in the workspace API, as it is in cargo (cargo test -p uv
, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh haha it's short for --python
right now. We might need to reconsider that?
I'll think about this some more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--from
? e.g. uv tool run --from foo -- bar
or uv tool run --from git+https://github.com/user/repo.git@branch -- bar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumb question, but how does it differ from --with
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use --with
(as in #3678), we will still infer the package that provides the tool from the command name so --with
is additive while this flag replaces the inferred requirement.
I considered having the first --with
package replace the inferred requirement but that seems confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is especially important for installation where we won't install entry points from additional dependencies, just the tool package (and I'd expect the uv tool run
semantics to match)
cafe018
to
0ac2052
Compare
uv tool run
uv tool run
We usually infer the package the tool is pulled from to be the same name as the tool itself, but that's not always the case. This allows users to provide a custom package.