-
Notifications
You must be signed in to change notification settings - Fork 765
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
Universal mode duplicates requirements lines #4885
Comments
Ok this doesn't happen in |
Thank you for bisecting, that's really helpful. cc @charliermarsh |
Based on some investigation: when I think what |
Yeah there should already be markers on the forked state that get propagated here. I'll take a look! |
Will prioritize this of course, hopefully fixed today but I have to travel in the afternoon. |
I'll probably revert if we don't figure it out today -- better to be strict than wrong. |
Yeah based on my investigation a very trivial fix is to comment out narrowing the forked state's Python version. (Which is essentially reverting any improvements) |
The PR #4707 introduced the notion of "version narrowing," where a Requires-Python constraint was _possibly_ narrowed whenever the universal resolver created a fork. The version narrowing would occur when the fork was a result of a marker expression on `python_version` that is *stricter* than the configured `Requires-Python` (via, say, `pyproject.toml`). The crucial conceptual change made by #4707 is therefore that `Requires-Python` is no longer an invariant configuration of resolution, but rather a mutable constraint that can vary from fork to fork. This in turn can result in some cases, such as in #4885, where different versions of dependencies are selected. We aren't sure whether we can fix those or not, with version narrowing, so for now, we do this revert to restore the previous behavior and we'll try to address the version narrowing some other time. This also adds the case from #4885 as a regression test, ensuring that we don't break that in the future. I confirmed that with version narrowing, this test outputs duplicate distributions. Without narrowing, there are no duplicates. Ref #4707, Fixes #4885
The PR #4707 introduced the notion of "version narrowing," where a Requires-Python constraint was _possibly_ narrowed whenever the universal resolver created a fork. The version narrowing would occur when the fork was a result of a marker expression on `python_version` that is *stricter* than the configured `Requires-Python` (via, say, `pyproject.toml`). The crucial conceptual change made by #4707 is therefore that `Requires-Python` is no longer an invariant configuration of resolution, but rather a mutable constraint that can vary from fork to fork. This in turn can result in some cases, such as in #4885, where different versions of dependencies are selected. We aren't sure whether we can fix those or not, with version narrowing, so for now, we do this revert to restore the previous behavior and we'll try to address the version narrowing some other time. This also adds the case from #4885 as a regression test, ensuring that we don't break that in the future. I confirmed that with version narrowing, this test outputs duplicate distributions. Without narrowing, there are no duplicates. Ref #4707, Fixes #4885
Is this supposed to be fixed for uv 0.2.24? I still see it, but in a very complex example, so I wanted to check before trying to create a more minimal reproducer. |
I believe so — feel free to file an issue. There are some known errors that we’re working on already, it may end up being a dupe but it’s totally fine. |
* Use `--universal` flag with uv pip compile * Upgrade to uv `0.2.26`, fixed astral-sh/uv#4885 * Update uv and remove `--no-strip-markers` Apparently `--universal` implies `--no-strip-markers`
I just noticed the
--universal
flag and it looks like just what we need withtrio
! However, when we try this out (though it's not shown in that PR), we run into an issue where requirement lines are duplicated.Here's a reproducer, I can't explain this well.
x.in
:And here's what is spit out in my terminal when I run
uv pip compile --universal --python-version=3.8 x.in
:See how the
sphinx
lines are duplcated! Note that essentially everything above (x.in
, command run) is minimized.I'd love to poke atnevermind, I don't think I'm able to given some investigation, as I think this requires a larger change.uv
's internals a bit and maybe fix this!Platform information:
I'm running Debian Linux but I also reproduced on Windows.
The text was updated successfully, but these errors were encountered: