mirror of https://github.com/astral-sh/uv
Reframe `--locked` and `--frozen` as `--check` operations for `uv lock` (#9662)
Closes https://github.com/astral-sh/uv/issues/7639
This commit is contained in:
parent
00a4adfc46
commit
84285b69e6
|
|
@ -3042,22 +3042,26 @@ pub struct SyncArgs {
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
pub struct LockArgs {
|
pub struct LockArgs {
|
||||||
/// Assert that the `uv.lock` will remain unchanged.
|
/// Check if the lockfile is up-to-date.
|
||||||
///
|
///
|
||||||
/// Requires that the lockfile is up-to-date. If the lockfile is missing or
|
/// Asserts that the `uv.lock` would remain unchanged after a resolution. If the lockfile is
|
||||||
/// needs to be updated, uv will exit with an error.
|
/// missing or needs to be updated, uv will exit with an error.
|
||||||
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
///
|
||||||
pub locked: bool,
|
/// Equivalent to `--locked`.
|
||||||
|
#[arg(long, alias = "locked", env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "check_exists")]
|
||||||
|
pub check: bool,
|
||||||
|
|
||||||
/// Assert that a `uv.lock` exists, without updating it.
|
/// Assert that a `uv.lock` exists without checking if it is up-to-date.
|
||||||
#[arg(long, env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "locked")]
|
///
|
||||||
pub frozen: bool,
|
/// Equivalent to `--frozen`.
|
||||||
|
#[arg(long, alias = "frozen", env = EnvVars::UV_FROZEN, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "check")]
|
||||||
|
pub check_exists: bool,
|
||||||
|
|
||||||
/// Perform a dry run, without writing the lockfile.
|
/// Perform a dry run, without writing the lockfile.
|
||||||
///
|
///
|
||||||
/// In dry-run mode, uv will resolve the project's dependencies and report on the resulting
|
/// In dry-run mode, uv will resolve the project's dependencies and report on the resulting
|
||||||
/// changes, but will not write the lockfile to disk.
|
/// changes, but will not write the lockfile to disk.
|
||||||
#[arg(long, conflicts_with = "frozen", conflicts_with = "locked")]
|
#[arg(long, conflicts_with = "check_exists", conflicts_with = "check")]
|
||||||
pub dry_run: bool,
|
pub dry_run: bool,
|
||||||
|
|
||||||
#[command(flatten)]
|
#[command(flatten)]
|
||||||
|
|
|
||||||
|
|
@ -990,8 +990,8 @@ impl LockSettings {
|
||||||
#[allow(clippy::needless_pass_by_value)]
|
#[allow(clippy::needless_pass_by_value)]
|
||||||
pub(crate) fn resolve(args: LockArgs, filesystem: Option<FilesystemOptions>) -> Self {
|
pub(crate) fn resolve(args: LockArgs, filesystem: Option<FilesystemOptions>) -> Self {
|
||||||
let LockArgs {
|
let LockArgs {
|
||||||
locked,
|
check,
|
||||||
frozen,
|
check_exists,
|
||||||
dry_run,
|
dry_run,
|
||||||
resolver,
|
resolver,
|
||||||
build,
|
build,
|
||||||
|
|
@ -1005,8 +1005,8 @@ impl LockSettings {
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
locked,
|
locked: check,
|
||||||
frozen,
|
frozen: check_exists,
|
||||||
dry_run,
|
dry_run,
|
||||||
python: python.and_then(Maybe::into_option),
|
python: python.and_then(Maybe::into_option),
|
||||||
refresh: Refresh::from(refresh),
|
refresh: Refresh::from(refresh),
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,14 @@ To avoid updating the environment during `uv run` invocations, use the `--no-syn
|
||||||
To assert the lockfile matches the project metadata, use the `--locked` flag. If the lockfile is not
|
To assert the lockfile matches the project metadata, use the `--locked` flag. If the lockfile is not
|
||||||
up-to-date, an error will be raised instead of updating the lockfile.
|
up-to-date, an error will be raised instead of updating the lockfile.
|
||||||
|
|
||||||
|
You can also check if the lockfile is up-to-date by passing the `--check` flag to `uv lock`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ uv lock --check
|
||||||
|
```
|
||||||
|
|
||||||
|
This is equivalent to the `--locked` flag for other commands.
|
||||||
|
|
||||||
### Upgrading locked package versions
|
### Upgrading locked package versions
|
||||||
|
|
||||||
By default, uv will prefer the locked versions of packages when running `uv sync` and `uv lock`.
|
By default, uv will prefer the locked versions of packages when running `uv sync` and `uv lock`.
|
||||||
|
|
|
||||||
|
|
@ -1790,6 +1790,18 @@ uv lock [OPTIONS]
|
||||||
<p>To view the location of the cache directory, run <code>uv cache dir</code>.</p>
|
<p>To view the location of the cache directory, run <code>uv cache dir</code>.</p>
|
||||||
|
|
||||||
<p>May also be set with the <code>UV_CACHE_DIR</code> environment variable.</p>
|
<p>May also be set with the <code>UV_CACHE_DIR</code> environment variable.</p>
|
||||||
|
</dd><dt><code>--check</code></dt><dd><p>Check if the lockfile is up-to-date.</p>
|
||||||
|
|
||||||
|
<p>Asserts that the <code>uv.lock</code> would remain unchanged after a resolution. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||||
|
|
||||||
|
<p>Equivalent to <code>--locked</code>.</p>
|
||||||
|
|
||||||
|
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||||
|
</dd><dt><code>--check-exists</code></dt><dd><p>Assert that a <code>uv.lock</code> exists without checking if it is up-to-date.</p>
|
||||||
|
|
||||||
|
<p>Equivalent to <code>--frozen</code>.</p>
|
||||||
|
|
||||||
|
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
|
||||||
</dd><dt><code>--color</code> <i>color-choice</i></dt><dd><p>Control colors in output</p>
|
</dd><dt><code>--color</code> <i>color-choice</i></dt><dd><p>Control colors in output</p>
|
||||||
|
|
||||||
<p>[default: auto]</p>
|
<p>[default: auto]</p>
|
||||||
|
|
@ -1845,9 +1857,6 @@ uv lock [OPTIONS]
|
||||||
<p>If a URL, the page must contain a flat list of links to package files adhering to the formats described above.</p>
|
<p>If a URL, the page must contain a flat list of links to package files adhering to the formats described above.</p>
|
||||||
|
|
||||||
<p>May also be set with the <code>UV_FIND_LINKS</code> environment variable.</p>
|
<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>--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>
|
</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>
|
||||||
|
|
@ -1910,11 +1919,6 @@ uv lock [OPTIONS]
|
||||||
|
|
||||||
<li><code>symlink</code>: Symbolically link packages from the wheel into the <code>site-packages</code> directory</li>
|
<li><code>symlink</code>: Symbolically link packages from the wheel into the <code>site-packages</code> directory</li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd><dt><code>--locked</code></dt><dd><p>Assert that the <code>uv.lock</code> will remain unchanged.</p>
|
|
||||||
|
|
||||||
<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>
|
</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>
|
<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