From 43dbdba578179d8e6ced763916b658dcfb9c53c6 Mon Sep 17 00:00:00 2001
From: Noam Teyssier <22600644+noamteyssier@users.noreply.github.com>
Date: Thu, 10 Jul 2025 11:50:50 -0700
Subject: [PATCH] feature: shorthand for --with (-w) in uvx and uv tool run
(#14530)
## 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
---
crates/uv-cli/src/lib.rs | 6 ++--
crates/uv/tests/it/tool_run.rs | 64 ++++++++++++++++++++++++++++++++++
docs/concepts/tools.md | 6 ++++
docs/reference/cli.md | 6 ++--
4 files changed, 76 insertions(+), 6 deletions(-)
diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs
index 3e9aba123..39dac54ba 100644
--- a/crates/uv-cli/src/lib.rs
+++ b/crates/uv-cli/src/lib.rs
@@ -3045,7 +3045,7 @@ pub struct RunArgs {
/// When used in a project, these dependencies will be layered on top of the project environment
/// in a separate, ephemeral environment. These dependencies are allowed to conflict with those
/// specified by the project.
- #[arg(long)]
+ #[arg(short = 'w', long)]
pub with: Vec
--upgrade-package, -P upgrade-packageAllow upgrades for a specific package, ignoring pinned versions in any existing output file. Implies --refresh-package
--verbose, -vUse verbose output.
You can configure fine-grained logging using the RUST_LOG environment variable. (https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives)
--with withRun with the given packages installed.
+--with, -w withRun with the given packages installed.
When used in a project, these dependencies will be layered on top of the project environment in a separate, ephemeral environment. These dependencies are allowed to conflict with those specified by the project.
--with-editable with-editableRun with the given packages installed in editable mode.
When used in a project, these dependencies will be layered on top of the project environment in a separate, ephemeral environment. These dependencies are allowed to conflict with those specified by the project.
@@ -1935,7 +1935,7 @@ uv tool run [OPTIONS] [COMMAND]--upgrade-package, -P upgrade-packageAllow upgrades for a specific package, ignoring pinned versions in any existing output file. Implies --refresh-package
--verbose, -vUse verbose output.
You can configure fine-grained logging using the RUST_LOG environment variable. (https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives)
--with withRun with the given packages installed
+--with, -w withRun with the given packages installed
--with-editable with-editableRun with the given packages installed in editable mode
When used in a project, these dependencies will be layered on top of the uv tool's environment in a separate, ephemeral environment. These dependencies are allowed to conflict with those specified.
--with-requirements with-requirementsRun with all packages listed in the given requirements.txt files
--upgrade-package, -P upgrade-packageAllow upgrades for a specific package, ignoring pinned versions in any existing output file. Implies --refresh-package
--verbose, -vUse verbose output.
You can configure fine-grained logging using the RUST_LOG environment variable. (https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives)
--with withInclude the following additional requirements
+--with, -w withInclude the following additional requirements
--with-editable with-editableInclude the given packages in editable mode
--with-requirements with-requirementsInclude all requirements listed in the given requirements.txt files