Skip to content
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

Add support for --dry-run mode in uv lock #7783

Merged
merged 9 commits into from
Oct 24, 2024

Conversation

tfsingh
Copy link
Contributor

@tfsingh tfsingh commented Sep 29, 2024

This PR adds support for uv lock --dry-run, as described in issue #6408.

One thing to note: this functionality, as implemented, isn't limited to -U (if someone adds a dependency to the project's pyproject.toml, the plan will include these changes).

// If the user specified `--upgrade-package`, then at best we can prefer some of
// the existing versions.
return Ok(Self::Preferable(lock));
if !dry_run {
Copy link
Contributor Author

@tfsingh tfsingh Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't do this check, when we use --dry-run with -U the caller (do_lock) will indicate there was an update even if there wasn't one.

I'm not the happiest with this change as it pollutes the do_lock and validate APIs. That being said, I'm not sure of a better approach (doesn't make sense to include dry_run as a variant/member of one of the enums/structs passed in imo, they all seem to be used quite widely) — open to suggestions!

@tfsingh tfsingh marked this pull request as ready for review September 30, 2024 16:41
@charliermarsh charliermarsh self-assigned this Sep 30, 2024
@charliermarsh charliermarsh changed the title Support uv lock --dry-run Add support for --dry-run mode in uv lock Oct 24, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) October 24, 2024 03:21
@charliermarsh charliermarsh merged commit 98523e2 into astral-sh:main Oct 24, 2024
63 checks passed
@charliermarsh charliermarsh added enhancement New feature or improvement to existing functionality cli Related to the command line interface labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants