feature: shorthand for --with (-w) in uvx and uv tool run (#14530)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

This is a small quality of life feature that adds a shorthand (`-w`) to
the `--with` flag for minimizing keystrokes.

Pretty minor, but I didn't see any conflicts with `-w` and thought this
could be a nice place for it.

```bash
# proposed addition (short)
uvx -w numpy ipython

# original (long)
uvx --with numpy ipython
```

## Test Plan

Added testing already in the P.R. - just copied over tests from the
`--with` flag

<!-- How was it tested? -->
This commit is contained in:
Noam Teyssier 2025-07-10 11:50:50 -07:00 committed by GitHub
parent b0348ee2a9
commit 43dbdba578
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 76 additions and 6 deletions

View file

@ -200,6 +200,12 @@ The `--with` option supports package specifications, so a specific version can b
$ uvx --with <extra-package>==<version> <tool-package>
```
The `-w` shorthand can be used in place of the `--with` option:
```console
$ uvx -w <extra-package> <tool-package>
```
If the requested version conflicts with the requirements of the tool package, package resolution
will fail and the command will error.