-
Notifications
You must be signed in to change notification settings - Fork 648
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
Move conflicting dependencies into PubGrub #1796
Conversation
(No reviews yet, this doesn't pass the test suite.) |
\cc @zanieb for visibility. |
40304a0
to
e5368db
Compare
2ccd7c9
to
b5fc027
Compare
╰─▶ Because only albatross==1.0.0 is available and albatross==1.0.0 depends on crow>=2.0.0b1, we can conclude that all versions of albatross depend on crow>=2.0.0b1. | ||
And because only crow<2.0.0b1 is available, we can conclude that all versions of albatross depend on crow>3.0.0. | ||
And because bluebird==1.0.0 depends on crow and only bluebird==1.0.0 is available, we can conclude that all versions of albatross and all versions of bluebird are incompatible. | ||
And because you require albatross and you require bluebird, we can conclude that the requirements are unsatisfiable. |
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 believe these are generally the result of dependencies being presented to PubGrub in a different order.
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.
Yeah it's a little weird but a known issue.
b5fc027
to
b599711
Compare
b22f853
to
9573239
Compare
crates/uv/tests/pip_compile.rs
Outdated
× No solution found when resolving dependencies: | ||
╰─▶ your requirements cannot be used because there are conflicting URLs for | ||
package `werkzeug`: | ||
- https://files.pythonhosted.org/packages/bd/24/11c3ea5a7e866bf2d97f0501d0b4b1c9bbeade102bb4b588f0d2919a5212/Werkzeug-2.0.1-py3-none-any.whl | ||
- https://files.pythonhosted.org/packages/ff/1d/960bb4017c68674a1cb099534840f18d3def3ce44aed12b5ed8b78e0153e/Werkzeug-2.0.0-py3-none-any.whl | ||
error: There are conflicting URLs for package `werkzeug`: | ||
- https://files.pythonhosted.org/packages/bd/24/11c3ea5a7e866bf2d97f0501d0b4b1c9bbeade102bb4b588f0d2919a5212/Werkzeug-2.0.1-py3-none-any.whl | ||
- https://files.pythonhosted.org/packages/ff/1d/960bb4017c68674a1cb099534840f18d3def3ce44aed12b5ed8b78e0153e/Werkzeug-2.0.0-py3-none-any.whl |
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.
Is this an improvement? Should we clarify that the URLs come from the provided requirements?
╰─▶ my-project cannot be used because there are conflicting versions for | ||
`django`: `django==5.0b1` does not intersect with `django==5.0a1` | ||
╰─▶ Because my-project depends on django==5.0b1 and my-project depends on | ||
django==5.0a1, we can conclude that the requirements are unsatisfiable. |
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.
Nice. It'll be better once we combine clauses #1009, maybe someday we should even track the source of dependencies so we can say what file each of these came from.
crates/uv/tests/pip_compile.rs
Outdated
/// Resolve a package from a `requirements.in` file, with a `constraints.txt` file pinning it to | ||
/// a specific URL. |
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 reads a little confusing
× No solution found when resolving dependencies: | ||
╰─▶ Because you require filelock==1.0.0 and you require filelock==3.8.0, we | ||
can conclude that the requirements are unsatisfiable. |
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 one definitely makes me want to open an issue to display the locations of direct requirements in error messages.
Cargo.toml
Outdated
pubgrub = { git = "https://github.com/zanieb/pubgrub", rev = "9b6d89cb8a0c7902815c8b2ae99106ba322ffb14" } | ||
pubgrub = { git = "https://github.com/zanieb/pubgrub", rev = "5d0270cc2932ab233bb7f66a09fb0764fed7154e" } |
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.
Let's make sure to merge upstream and use the main
commit before merging this one.
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.
Looks nice. Is there anything you wanted me to give a closer look?
6bfed7a
to
4df39a9
Compare
4df39a9
to
7e7e523
Compare
Summary
This revives a PR from long ago (#383 and astral-sh/pubgrub#24) that modifies how we deal with dependencies that are declared multiple times within a single package.
To quote from the originating PR:
The main issue with that PR was around its handling of URL dependencies, so this PR also refactors how we handle those. Previously, we stored URL dependencies on
PubGrubPackage
, but they were omitted from the hash and equality implementations ofPubGrubPackage
. This led to some really careful codepaths wherein we had to ensure that we always visited URLs before non-URL packages, so that the URL-inclusive versions were included in any hashmaps, etc. I considered preserving this approach, but it would require us to rely on lots of internal details of PubGrub (since we'd now be relying on PubGrub to merge those packages in the "right" order).So, instead, we now always set the URL on a given package, whenever that package was given a URL upfront. I think this is easier to reason about: if the user provided a URL for
flask
, then we should just always add the URL forflask
. If we see some other URL forflask
, we error, like before. If we see some unknown URL forflask
, we error, like before.Closes #1522.
Closes #1821.
Closes #1615.