mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-20 03:49:54 +00:00
Add support for UV_FROZEN and UV_LOCKED (#8340)
## Summary Closes https://github.com/astral-sh/uv/issues/8321.
This commit is contained in:
parent
69d5e084d5
commit
d53d580221
4 changed files with 38 additions and 14 deletions
|
|
@ -2683,7 +2683,7 @@ pub struct RunArgs {
|
|||
///
|
||||
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
|
||||
/// needs to be updated, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub locked: bool,
|
||||
|
||||
/// Run without updating the `uv.lock` file.
|
||||
|
|
@ -2693,7 +2693,7 @@ pub struct RunArgs {
|
|||
/// exit with an error. If the `pyproject.toml` includes changes to
|
||||
/// dependencies that have not been included in the lockfile yet, they will
|
||||
/// not be present in the environment.
|
||||
#[arg(long, conflicts_with = "locked")]
|
||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
||||
pub frozen: bool,
|
||||
|
||||
/// Run the given path as a Python script.
|
||||
|
|
@ -2836,7 +2836,7 @@ pub struct SyncArgs {
|
|||
///
|
||||
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
|
||||
/// needs to be updated, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub locked: bool,
|
||||
|
||||
/// Sync without updating the `uv.lock` file.
|
||||
|
|
@ -2846,7 +2846,7 @@ pub struct SyncArgs {
|
|||
/// exit with an error. If the `pyproject.toml` includes changes to dependencies
|
||||
/// that have not been included in the lockfile yet, they will not be
|
||||
/// present in the environment.
|
||||
#[arg(long, conflicts_with = "locked")]
|
||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
||||
pub frozen: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
|
|
@ -2896,11 +2896,11 @@ pub struct LockArgs {
|
|||
///
|
||||
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
|
||||
/// needs to be updated, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub locked: bool,
|
||||
|
||||
/// Assert that a `uv.lock` exists, without updating it.
|
||||
#[arg(long, conflicts_with = "locked")]
|
||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
||||
pub frozen: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
|
|
@ -3009,13 +3009,13 @@ pub struct AddArgs {
|
|||
///
|
||||
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
|
||||
/// needs to be updated, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub locked: bool,
|
||||
|
||||
/// Add dependencies without re-locking the project.
|
||||
///
|
||||
/// The project environment will not be synced.
|
||||
#[arg(long, conflicts_with = "locked")]
|
||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
||||
pub frozen: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
|
|
@ -3079,13 +3079,13 @@ pub struct RemoveArgs {
|
|||
///
|
||||
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
|
||||
/// needs to be updated, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub locked: bool,
|
||||
|
||||
/// Remove dependencies without re-locking the project.
|
||||
///
|
||||
/// The project environment will not be synced.
|
||||
#[arg(long, conflicts_with = "locked")]
|
||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
||||
pub frozen: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
|
|
@ -3154,13 +3154,13 @@ pub struct TreeArgs {
|
|||
///
|
||||
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
|
||||
/// needs to be updated, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub locked: bool,
|
||||
|
||||
/// Display the requirements without locking the project.
|
||||
///
|
||||
/// If the lockfile is missing, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "locked")]
|
||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
||||
pub frozen: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
|
|
@ -3302,13 +3302,13 @@ pub struct ExportArgs {
|
|||
///
|
||||
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
|
||||
/// needs to be updated, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub locked: bool,
|
||||
|
||||
/// Do not update the `uv.lock` before exporting.
|
||||
///
|
||||
/// If a `uv.lock` does not exist, uv will exit with an error.
|
||||
#[arg(long, conflicts_with = "locked")]
|
||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
||||
pub frozen: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
|
|
|
|||
|
|
@ -105,6 +105,12 @@ impl EnvVars {
|
|||
/// Equivalent to the `--no-sync` argument. Skips syncing the environment.
|
||||
pub const UV_NO_SYNC: &'static str = "UV_NO_SYNC";
|
||||
|
||||
/// Equivalent to the `--locked` argument. Assert that the `uv.lock` will remain unchanged.
|
||||
pub const UV_LOCKED: &'static str = "UV_LOCKED";
|
||||
|
||||
/// Equivalent to the `--frozen` argument. Run without updating the `uv.lock` file.
|
||||
pub const UV_FROZEN: &'static str = "UV_FROZEN";
|
||||
|
||||
/// Equivalent to the `--preview` argument. Enables preview mode.
|
||||
pub const UV_PREVIEW: &'static str = "UV_PREVIEW";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue