-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Running uv lock --check with outdated lockfile will print that --check was passed, instead of --locked
#16322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… `--check` or `--locked` was passed, instead of `--locked` only
|
I was imaging instead setting up a type like sort of like uv/crates/uv/src/commands/tool/run.rs Lines 65 to 72 in b4168e6
uv/crates/uv/src/commands/python/install.rs Lines 153 to 176 in 13a976a
|
…ght flag which prevented `uv` command to run on outdated lockfile.
|
@zanieb Thanks for the review, I applied necessary changes. |
uv lock --check with outdated lockfile will print that --check or --locked was passed, instead of --locked onlyuv lock --check with outdated lockfile will print that --check was passed, instead of --locked
uv lock --check with outdated lockfile will print that --check was passed, instead of --locked uv lock --check with outdated lockfile will print that --check was passed, instead of --locked
konstin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
crates/uv-cli/src/lib.rs
Outdated
| /// missing or needs to be updated, uv will exit with an error. | ||
| /// | ||
| /// Equivalent to `--check`. | ||
| #[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["check_exists", "upgrade", "check"])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should hide this one, I think.
| if matches!(lock_check, LockCheck::Enabled(_)) { | ||
| warn_user_once!( | ||
| "`--locked` is a no-op for Python scripts with inline metadata, which always run in isolation" | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we use the source in this warning message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(there are some more instances of this following)
| if matches!(lock_check, LockCheck::Enabled(_)) { | ||
| LockMode::Locked(target.interpreter(), lock_check.source().unwrap()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use if let LockCheck::Enabled(source) = lock_check { so you can avoid the unwrap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(there are some more instances of this following)
| fn check_outdated_lock() -> Result<()> { | ||
| // Given a test context with a pyproject.toml | ||
| let context = TestContext::new("3.12"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused that the setup for this test case changed. Why did it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from my old implementation.
I badly reverted the test case I added for that, I will fix that.
|
Nice! That's what I had in mind :) |
…k` one (but needed to get lock source)
|
@zanieb Thanks for the insightful review again, I applied needed changes 👍 |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.5` -> `0.9.7` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>astral-sh/uv (astral-sh/uv)</summary> ### [`v0.9.7`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#097) [Compare Source](astral-sh/uv@0.9.6...0.9.7) Released on 2025-10-30. ##### Enhancements - Add Windows x86-32 emulation support to interpreter architecture checks ([#​13475](astral-sh/uv#13475)) - Improve readability of progress bars ([#​16509](astral-sh/uv#16509)) - Add GitHub attestations for uv release artifacts ([#​11357](astral-sh/uv#11357)) ##### Bug fixes - Drop terminal coloring from `uv auth token` output ([#​16504](astral-sh/uv#16504)) - Don't use UV\_LOCKED to enable `--check` flag ([#​16521](astral-sh/uv#16521)) ### [`v0.9.6`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#096) [Compare Source](astral-sh/uv@0.9.5...0.9.6) Released on 2025-10-29. This release contains an upgrade to Astral's fork of `async_zip`, which addresses potential sources of ZIP parsing differentials between uv and other Python packaging tooling. See [GHSA-pqhf-p39g-3x64](GHSA-pqhf-p39g-3x64) for additional details. ##### Security - Address ZIP parsing differentials ([GHSA-pqhf-p39g-3x64](GHSA-pqhf-p39g-3x64)) ##### Python - Upgrade GraalPy to 25.0.1 ([#​16401](astral-sh/uv#16401)) ##### Enhancements - Add `--clear` to `uv build` to remove old build artifacts ([#​16371](astral-sh/uv#16371)) - Add `--no-create-gitignore` to `uv build` ([#​16369](astral-sh/uv#16369)) - Do not error when a virtual environment directory cannot be removed due to a busy error ([#​16394](astral-sh/uv#16394)) - Improve hint on `pip install --system` when externally managed ([#​16392](astral-sh/uv#16392)) - Running `uv lock --check` with outdated lockfile will print that `--check` was passed, instead of `--locked` ([#​16322](astral-sh/uv#16322)) - Update `uv init` template for Maturin ([#​16449](astral-sh/uv#16449)) - Improve ordering of Python sources in logs ([#​16463](astral-sh/uv#16463)) - Restore DockerHub release images and annotations ([#​16441](astral-sh/uv#16441)) ##### Bug fixes - Check for matching Python implementation during `uv python upgrade` ([#​16420](astral-sh/uv#16420)) - Deterministically order `--find-links` distributions ([#​16446](astral-sh/uv#16446)) - Don't panic in `uv export --frozen` when the lockfile is outdated ([#​16407](astral-sh/uv#16407)) - Fix root of `uv tree` when `--package` is used with circular dependencies ([#​15908](astral-sh/uv#15908)) - Show package list with `pip freeze --quiet` ([#​16491](astral-sh/uv#16491)) - Limit `uv auth login pyx.dev` retries to 60s ([#​16498](astral-sh/uv#16498)) - Add an empty group with `uv add --group ... -r ...` ([#​16490](astral-sh/uv#16490)) ##### Documentation - Update docs for maturin build backend init template ([#​16469](astral-sh/uv#16469)) - Update docs to reflect previous changes to signal forwarding semantics ([#​16430](astral-sh/uv#16430)) - Add instructions for installing via MacPorts ([#​16039](astral-sh/uv#16039)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNjkuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE2OS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Hello,
Summary
This PR fixes the confusing error message when running
uv lock --checkwith an outdated lockfile.Previously, the error message incorrectly stated that
--lockedwas provided, even when the user used--check.Now, the error message correctly indicates which flag was used: either
--checkor--locked.This closes #14105.
Test plan
check_outdated_lockinlock.rs) to verify the new error message includes the correct flag.