Allow workspace requirements to be ignored during uv run (#3108)
This commit is contained in:
@@ -1641,6 +1641,11 @@ pub(crate) struct RunArgs {
|
||||
/// Run with the given packages installed.
|
||||
#[arg(long)]
|
||||
pub(crate) with: Vec<String>,
|
||||
|
||||
/// Run without the current workspace installed.
|
||||
#[arg(long)]
|
||||
pub(crate) no_workspace: bool,
|
||||
// TODO(zanieb): Consider alternative names like `--no-project` or `--without-project`
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
|
||||
@@ -43,6 +43,7 @@ pub(crate) async fn run(
|
||||
args: Vec<String>,
|
||||
mut requirements: Vec<RequirementsSource>,
|
||||
isolated: bool,
|
||||
no_workspace: bool,
|
||||
cache: &Cache,
|
||||
printer: Printer,
|
||||
) -> Result<ExitStatus> {
|
||||
@@ -52,9 +53,10 @@ pub(crate) async fn run(
|
||||
// cannot be applied to transitive dependencies.
|
||||
let overrides = requirements.clone();
|
||||
|
||||
// TODO(zanieb): Provide an opt-out for this behavior
|
||||
if let Some(workspace_requirements) = find_workspace_requirements()? {
|
||||
requirements.extend(workspace_requirements);
|
||||
if !no_workspace {
|
||||
if let Some(workspace_requirements) = find_workspace_requirements()? {
|
||||
requirements.extend(workspace_requirements);
|
||||
}
|
||||
}
|
||||
|
||||
// Detect the current Python interpreter.
|
||||
|
||||
@@ -599,6 +599,7 @@ async fn run() -> Result<ExitStatus> {
|
||||
args.args,
|
||||
requirements,
|
||||
args.isolated,
|
||||
args.no_workspace,
|
||||
&cache,
|
||||
printer,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user