Add --locked and --frozen to uv run CLI (#5196)

## Summary

You can now use `uv run --locked` to assert that the lockfile doesn't
change, or `uv run --frozen` to run without attempting to update the
lockfile at all.

Closes https://github.com/astral-sh/uv/issues/5185.
This commit is contained in:
Charlie Marsh
2024-07-18 14:55:17 -04:00
committed by GitHub
parent 6a6e3b464f
commit dfe2faa71e
8 changed files with 301 additions and 101 deletions
+16
View File
@@ -1784,6 +1784,14 @@ impl ExternalCommand {
#[derive(Args)]
#[allow(clippy::struct_excessive_bools)]
pub struct RunArgs {
/// Assert that the `uv.lock` will remain unchanged.
#[arg(long, conflicts_with = "frozen")]
pub locked: bool,
/// Install without updating the `uv.lock` file.
#[arg(long, conflicts_with = "locked")]
pub frozen: bool,
/// Include optional dependencies from the extra group name; may be provided more than once.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
@@ -1909,6 +1917,14 @@ pub struct SyncArgs {
#[derive(Args)]
#[allow(clippy::struct_excessive_bools)]
pub struct LockArgs {
/// Assert that the `uv.lock` will remain unchanged.
#[arg(long, conflicts_with = "frozen")]
pub locked: bool,
/// Assert that a `uv.lock` exists, without updating it.
#[arg(long, conflicts_with = "locked")]
pub frozen: bool,
#[command(flatten)]
pub resolver: ResolverArgs,