diff --git a/crates/uv/src/cli.rs b/crates/uv/src/cli.rs index 4bdc8a398..3356f1674 100644 --- a/crates/uv/src/cli.rs +++ b/crates/uv/src/cli.rs @@ -1946,6 +1946,10 @@ pub(crate) struct ToolRunArgs { #[arg(long)] pub(crate) from: Option, + /// Include the following extra requirements. + #[arg(long)] + pub(crate) with: Vec, + /// The Python interpreter to use to build the run environment. #[arg( long, diff --git a/crates/uv/src/commands/tool/run.rs b/crates/uv/src/commands/tool/run.rs index c7cddddcc..20164d688 100644 --- a/crates/uv/src/commands/tool/run.rs +++ b/crates/uv/src/commands/tool/run.rs @@ -25,6 +25,7 @@ pub(crate) async fn run( args: Vec, python: Option, from: Option, + with: Vec, _isolated: bool, preview: PreviewMode, connectivity: Connectivity, @@ -35,10 +36,12 @@ pub(crate) async fn run( warn_user!("`uv tool run` is experimental and may change without warning."); } - // TODO(zanieb): Allow users to pass additional requirements let requirements = [RequirementsSource::from_package( from.unwrap_or_else(|| target.clone()), - )]; + )] + .into_iter() + .chain(with.into_iter().map(RequirementsSource::from_package)) + .collect::>(); // TODO(zanieb): When implementing project-level tools, discover the project and check if it has the tool // TOOD(zanieb): Determine if we sould layer on top of the project environment if it is present diff --git a/crates/uv/src/main.rs b/crates/uv/src/main.rs index 8dd6fc175..2020f798f 100644 --- a/crates/uv/src/main.rs +++ b/crates/uv/src/main.rs @@ -622,6 +622,7 @@ async fn run() -> Result { args.args, args.python, args.from, + args.with, globals.isolated, globals.preview, globals.connectivity,