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

--resolution lowest with uv sync needs to discard preferences #5226

Closed
konstin opened this issue Jul 19, 2024 · 14 comments · Fixed by #5264
Closed

--resolution lowest with uv sync needs to discard preferences #5226

konstin opened this issue Jul 19, 2024 · 14 comments · Fixed by #5264
Assignees
Labels
enhancement New feature or request preview Experimental behavior

Comments

@konstin
Copy link
Member

konstin commented Jul 19, 2024

Currently, when switching to uv sync --resolution lowest from uv sync, nothing changes, because we're using the existing preferences. This breaks the use case for --resolution lowest.

We should instead discard the preferences when using --resolution lowest or --resolution lowest-direct, since these two modes are not for regular development, but for testing your dependency specifiers.

@konstin konstin added bug Something isn't working preview Experimental behavior labels Jul 19, 2024
@charliermarsh charliermarsh removed the bug Something isn't working label Jul 19, 2024
@charliermarsh
Copy link
Member

I don't consider this a bug, but we can consider changing it.

@charliermarsh
Copy link
Member

I don't think discarding preferences alone would change this. We'd also have to skip the "resolve from lockfile" behavior.

@charliermarsh
Copy link
Member

Perhaps we always do both these things if --resolution is set explicitly...? Like, say that it implies --upgrade?

@charliermarsh
Copy link
Member

I can try it.

@charliermarsh charliermarsh self-assigned this Jul 19, 2024
@charliermarsh charliermarsh added the enhancement New feature or request label Jul 19, 2024
@charliermarsh
Copy link
Member

I guess arguably --prerelease and other settings should have the same effect, but I don't know where to draw the line.

@konstin
Copy link
Member Author

konstin commented Jul 19, 2024

Do we need to record the settings used for the resolution in uv.lock?

@charliermarsh
Copy link
Member

The downside of that approach is that it wouldn't work for uv pip install --resolution lowest, which has also led to confusion before and would be nice to solve here.

@charliermarsh
Copy link
Member

No obviously-good solution here... Options are something like:

  • Use --upgrade semantics whenever --resolution is explicitly provided. But, how does this work when --resolution is provided via a configuration file? We never pin? That wouldn't work.
  • Write the resolution and prerelease to the lockfile, so that we can rerun when they're mismatched. This is good, but it doesn't solve the same problem that already exists for uv pip install, which has been described before: I expected --resolution=lowest to imply --reinstall for an existing package #1647.

I suspect we need to do the latter, though.

@charliermarsh
Copy link
Member

We probably want to record the resolution, prerelease, and exclude-newer setting.

@charliermarsh
Copy link
Member

Working on that change (adding resolution options to the lockfile).

@charliermarsh
Copy link
Member

I wonder if, eventually, we'd want to enable projects to have multiple locks for this purpose. Or enable the lockfile to contain multiple entries if they resolve with different input settings.

@zanieb
Copy link
Member

zanieb commented Jul 21, 2024

It seems like it depends on the use-case. Are you going to always run your project in lowest resolution because you prefer it? I don't know why you'd need multiple lock files in that case. Or is it a single invocation in CI to test if the lowest versions are correct? There, I don't think the lock matters at all?

@charliermarsh
Copy link
Member

Are you commenting on the originating issue here or my previous comment?

@zanieb
Copy link
Member

zanieb commented Jul 21, 2024

The previous comment.

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 a pull request may close this issue.

3 participants