From 0133bcc8ca36e47eaf42946a157b8dbb1f3b1be8 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Fri, 20 Jun 2025 13:34:45 -0700 Subject: [PATCH] (f)lock during `uv run` (#14153) This is very similar to the locking added for `uv sync`, `uv add`, and `uv remove` in https://github.com/astral-sh/uv/pull/13869. Improving our (f)locking in general is tracked in https://github.com/astral-sh/uv/issues/13883. --- crates/uv/src/commands/project/run.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/uv/src/commands/project/run.rs b/crates/uv/src/commands/project/run.rs index 8a510fa8c..ee3caeafa 100644 --- a/crates/uv/src/commands/project/run.rs +++ b/crates/uv/src/commands/project/run.rs @@ -240,6 +240,8 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl .await? .into_environment()?; + let _lock = environment.lock().await?; + // Determine the lock mode. let mode = if frozen { LockMode::Frozen @@ -382,6 +384,8 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl ) }); + let _lock = environment.lock().await?; + match update_environment( environment, spec, @@ -694,6 +698,8 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl .map(|lock| (lock, project.workspace().install_path().to_owned())); } } else { + let _lock = venv.lock().await?; + // Determine the lock mode. let mode = if frozen { LockMode::Frozen