mirror of https://github.com/astral-sh/uv
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
|
|
@ -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";
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,10 @@ uv accepts the following command-line arguments as environment variables:
|
|||
set, uv will use this password for publishing.
|
||||
- `UV_NO_SYNC`: Equivalent to the `--no-sync` command-line argument. If set, uv will skip updating
|
||||
the environment.
|
||||
- `UV_LOCKED`: Equivalent to the `--locked` command-line argument. If set, uv will assert that the
|
||||
`uv.lock` remains unchanged.
|
||||
- `UV_FROZEN`: Equivalent to the `--frozen` command-line argument. If set, uv will run without
|
||||
updating the `uv.lock` file.
|
||||
|
||||
In each case, the corresponding command-line argument takes precedence over an environment variable.
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ uv run [OPTIONS] [COMMAND]
|
|||
|
||||
<p>Instead of checking if the lockfile is up-to-date, uses the versions in the lockfile as the source of truth. If the lockfile is missing, uv will exit with an error. If the <code>pyproject.toml</code> includes changes to dependencies that have not been included in the lockfile yet, they will not be present in the environment.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
|
||||
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
|
||||
|
||||
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
|
||||
|
|
@ -232,6 +233,7 @@ uv run [OPTIONS] [COMMAND]
|
|||
|
||||
<p>Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||
</dd><dt><code>--module</code>, <code>-m</code></dt><dd><p>Run a Python module.</p>
|
||||
|
||||
<p>Equivalent to <code>python -m <module></code>.</p>
|
||||
|
|
@ -749,6 +751,7 @@ uv add [OPTIONS] <PACKAGES|--requirements <REQUIREMENTS>>
|
|||
|
||||
<p>The project environment will not be synced.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
|
||||
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
|
||||
|
||||
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
|
||||
|
|
@ -813,6 +816,7 @@ uv add [OPTIONS] <PACKAGES|--requirements <REQUIREMENTS>>
|
|||
|
||||
<p>Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||
</dd><dt><code>--native-tls</code></dt><dd><p>Whether to load TLS certificates from the platform’s native certificate store.</p>
|
||||
|
||||
<p>By default, uv loads certificates from the bundled <code>webpki-roots</code> crate. The <code>webpki-roots</code> are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).</p>
|
||||
|
|
@ -1081,6 +1085,7 @@ uv remove [OPTIONS] <PACKAGES>...
|
|||
|
||||
<p>The project environment will not be synced.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
|
||||
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
|
||||
|
||||
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
|
||||
|
|
@ -1145,6 +1150,7 @@ uv remove [OPTIONS] <PACKAGES>...
|
|||
|
||||
<p>Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||
</dd><dt><code>--native-tls</code></dt><dd><p>Whether to load TLS certificates from the platform’s native certificate store.</p>
|
||||
|
||||
<p>By default, uv loads certificates from the bundled <code>webpki-roots</code> crate. The <code>webpki-roots</code> are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).</p>
|
||||
|
|
@ -1401,6 +1407,7 @@ uv sync [OPTIONS]
|
|||
|
||||
<p>Instead of checking if the lockfile is up-to-date, uses the versions in the lockfile as the source of truth. If the lockfile is missing, uv will exit with an error. If the <code>pyproject.toml</code> includes changes to dependencies that have not been included in the lockfile yet, they will not be present in the environment.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
|
||||
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
|
||||
|
||||
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
|
||||
|
|
@ -1469,6 +1476,7 @@ uv sync [OPTIONS]
|
|||
|
||||
<p>Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||
</dd><dt><code>--native-tls</code></dt><dd><p>Whether to load TLS certificates from the platform’s native certificate store.</p>
|
||||
|
||||
<p>By default, uv loads certificates from the bundled <code>webpki-roots</code> crate. The <code>webpki-roots</code> are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).</p>
|
||||
|
|
@ -1717,6 +1725,7 @@ uv lock [OPTIONS]
|
|||
<p>May also be set with the <code>UV_FIND_LINKS</code> environment variable.</p>
|
||||
</dd><dt><code>--frozen</code></dt><dd><p>Assert that a <code>uv.lock</code> exists, without updating it</p>
|
||||
|
||||
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
|
||||
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
|
||||
|
||||
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
|
||||
|
|
@ -1783,6 +1792,7 @@ uv lock [OPTIONS]
|
|||
|
||||
<p>Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||
</dd><dt><code>--native-tls</code></dt><dd><p>Whether to load TLS certificates from the platform’s native certificate store.</p>
|
||||
|
||||
<p>By default, uv loads certificates from the bundled <code>webpki-roots</code> crate. The <code>webpki-roots</code> are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).</p>
|
||||
|
|
@ -2023,6 +2033,7 @@ uv export [OPTIONS]
|
|||
|
||||
<p>If a <code>uv.lock</code> does not exist, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
|
||||
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
|
||||
|
||||
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
|
||||
|
|
@ -2089,6 +2100,7 @@ uv export [OPTIONS]
|
|||
|
||||
<p>Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||
</dd><dt><code>--native-tls</code></dt><dd><p>Whether to load TLS certificates from the platform’s native certificate store.</p>
|
||||
|
||||
<p>By default, uv loads certificates from the bundled <code>webpki-roots</code> crate. The <code>webpki-roots</code> are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).</p>
|
||||
|
|
@ -2338,6 +2350,7 @@ uv tree [OPTIONS]
|
|||
|
||||
<p>If the lockfile is missing, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
|
||||
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>
|
||||
|
||||
</dd><dt><code>--index</code> <i>index</i></dt><dd><p>The URLs to use when resolving dependencies, in addition to the default index.</p>
|
||||
|
|
@ -2406,6 +2419,7 @@ uv tree [OPTIONS]
|
|||
|
||||
<p>Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||
</dd><dt><code>--native-tls</code></dt><dd><p>Whether to load TLS certificates from the platform’s native certificate store.</p>
|
||||
|
||||
<p>By default, uv loads certificates from the bundled <code>webpki-roots</code> crate. The <code>webpki-roots</code> are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).</p>
|
||||
|
|
|
|||
Loading…
Reference in New Issue