(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.
This commit is contained in:
Jack O'Connor 2025-06-20 13:34:45 -07:00 committed by GitHub
parent 1dbe750452
commit 0133bcc8ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -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