-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Combine dependency clauses with the same root #3225
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
Conversation
@@ -366,7 +366,7 @@ fn excluded_only_compatible_version() { | |||
And because you require one of: | |||
package-a<2.0.0 | |||
package-a>2.0.0 | |||
and you require package-b>=2.0.0,<3.0.0, we can conclude that the requirements are unsatisfiable. | |||
and package-b>=2.0.0,<3.0.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 I'm a little unsure about, but I think it's still clearer.
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.
Hm interesting thanks for flagging. It does seem like an improvement, I think.
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.
Just noticed the extra whitespace.
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 wonder if you require package-a but also package-b
would be better in general.
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'm not sure that generalizes well for the "proof" that's being stated.
@zanieb you mentioned that we might want to combine clauses within PubGrub itself. Is there a chance for false reporting with a transformation like this during formatting or does modifying PubGrub just allow for more types of simplification? |
Are you referring to #1673 (comment) or something else? This looks like a really reasonable step. In contrast to #1673, this implementation seems quite safe. I don't think this could false-report. I believe the alternative to handling this in the formatter is to derive a new tree with some collapsed nodes. We could look into implementing this in the default PubGrub formatter as well to improve the error messages it displays. I'm not sure we could collapse the nodes in PubGrub's resolver — that's more like #1901 which requires pubgrub-rs/pubgrub#208. We may also be able to use this pattern this for other incompatibility types e.g. instead of "because foo is unavailable and bar is unavailable" we could say "because foo and bar are unavailable". |
Nice work :) |
e44f998
to
59e4be9
Compare
Includes astral-sh/packse#179 for #3225 ``` uv pip compile scripts/scenarios/requirements.in -o scripts/scenarios/requirements.txt --refresh-package packse --upgrade cargo dev fetch-python source .env ./scripts/sync_scenarios.sh ```
59e4be9
to
430ec37
Compare
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.
Sweet! Might be worth opening some issues for those follow-ups I mentioned so we don't forget about them.
Thank you so much for the progress here. Even this targeted fix is probably worth up streaming in pubgrub at some point. |
Summary
Simplifies dependency errors of the form
you require package-a and you require package-b
toyou require package-a and package-b
. Resolves #1009.