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

Store resolution options in lockfile #5264

Merged
merged 1 commit into from
Jul 22, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

This PR modifies the lockfile to include the impactful resolution settings, like the resolution and pre-release mode. If any of those values change, we want to ignore the existing lockfile. Otherwise, --resolution lowest-direct will typically have no effect, which is really unintuitive.

Closes #5226.

@charliermarsh charliermarsh added enhancement New feature or request preview Experimental behavior labels Jul 21, 2024
match self {
Self::Highest => write!(f, "highest"),
Self::Lowest => write!(f, "lowest"),
Self::LowestDirect => write!(f, "lowest-direct"),
Copy link
Member Author

Choose a reason for hiding this comment

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

Does anyone know how to get these automatically from the Serde implementation, in to_toml?

// Write the settings that were used to generate the resolution.
// This enables us to invalidate the lockfile if the user changes
// their settings.
if self.resolution_mode != ResolutionMode::default() {
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to omit these if users use the default. It means we may have the "wrong" behavior if we change the default, but I think that's pretty unlikely, and even still, it's kind of fine -- we'd just regenerate their lock. The upside is that we almost never write these, so the lockfile remains succinct.

@charliermarsh charliermarsh merged commit 5a23f05 into main Jul 22, 2024
54 checks passed
@charliermarsh charliermarsh deleted the charlie/save-settings branch July 22, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--resolution lowest with uv sync needs to discard preferences
2 participants