-
Notifications
You must be signed in to change notification settings - Fork 760
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
Improve resolver error messages referencing workspace members #6092
Conversation
@@ -388,7 +388,7 @@ werkzeug==3.0.1 | |||
|
|||
----- stderr ----- | |||
× No solution found when resolving dependencies: | |||
╰─▶ Because flask==3.0.2 depends on click>=8.1.3 and you require click==7.0.0, we can conclude that your requirements and flask==3.0.2 are incompatible. | |||
╰─▶ Because flask==3.0.2 depends on click>=8.1.3 and you require click==7.0.0, we can conclude that the requirements and flask==3.0.2 are incompatible. |
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.
"the" is maybe suspect here, is it better?
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.
No, sorry I should have called this out. This made it easier to consolidate some logic without changing a ton of snapshots. I'm planning to change it to "your" everywhere in a follow-up.
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.
Rad.
@@ -903,9 +987,49 @@ struct PackageRange<'a> { | |||
package: &'a PubGrubPackage, | |||
range: &'a Range<Version>, | |||
kind: PackageRangeKind, | |||
formatter: Option<&'a PubGrubReportFormatter<'a>>, |
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 that feels a bit off. But at least it's all contained in this file.
e4b0e3e
to
c32128c
Compare
…ad of `NoVersions`
c32128c
to
b03445b
Compare
Extends #6092 to improve resolver error messages for workspaces that have a single member. As before, this requires a two-step approach of 1. Traversing the derivation tree and collapsing some members. In this case, we drop the empty root node in favor of the project. 2. Using special-case formatting for packages. In this case, the workspace package is referred to with "your project" instead of its name.
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!
╰─▶ Because there are no versions of xyz and project==0.1.0 depends on xyz, we can conclude that project==0.1.0 cannot be used. | ||
And because only project==0.1.0 is available and you require project, we can conclude that the requirements are unsatisfiable. | ||
╰─▶ Because there are no versions of xyz and project depends on xyz, we can conclude that project's requirements are unsatisfiable. | ||
And because your workspace requires project, we can conclude that your workspace's 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 looks much nicer.
…ith optional dependencies (#6123) We have bad error messages for optional (extra) dependencies and development dependencies in workspaces: 1. We weren't showing the full package, so we'd drop `:dev` and `[extra]` by accident 2. We didn't include derived packages, e.g., `member[extra]` in tree processing collapse operation, so we'd include extra clauses like the ones we removed in #6092 Also - Reverts f0de4f7 — it turns out it wasn't quite correct and it didn't seem worth using the custom incompatibility anymore. - Fixes a bug in the display of `package:dev` which was not showing `:dev` for some variants (see 94d8020)
Uses my expanding tree reduction knowledge from #6092 to improve the long-standing issue of verbose messages for unavailable packages. Implements pubgrub-rs/pubgrub#232, but post-resolution instead of during resolution. Partially addresses #5046 Closes #2519
An extension of #6090 that replaces #6066.
In brief,
NoVersion
incompatibilities for workspace members from the derivation tree. This avoids showing redundant clauses likeBecause only bird==0.1.0 is available and bird==0.1.0 depends on anyio==4.3.0, we can conclude that all versions of bird depend on anyio==4.3.0.
. As a minor note, we use a custom incompatibility kind to mark these incompatibilities at resolution-time instead of afterwards.your workspace requires bird
rather thanyou require bird
bird
instead ofbird==0.1.0
bird's requirements are unsatisfiable
instead ofbird cannot be used
.your requirements are unsatisfiable
we sayyour workspace's requirements are unsatisfiable
when in a workspace, since we're not in a "provide direct requirements" paradigm.As an annoying but minor implementation detail,
PackageRange
now requires access to thePubGrubReportFormatter
so it can determine if it is formatting a workspace member or not. We could probably improve the abstractions in the future.As a follow-up, we should additional special casing for "single project" workspaces to avoid mention of the workspace concept in simple projects. However, it looks like this will require additional tree manipulations so I'm going to keep it separate.