Improve resolver error messages referencing workspace members#6092
Merged
Improve resolver error messages referencing workspace members#6092
Conversation
This was referenced Aug 14, 2024
| ----- 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. |
Member
There was a problem hiding this comment.
"the" is maybe suspect here, is it better?
Member
Author
There was a problem hiding this comment.
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.
| package: &'a PubGrubPackage, | ||
| range: &'a Range<Version>, | ||
| kind: PackageRangeKind, | ||
| formatter: Option<&'a PubGrubReportFormatter<'a>>, |
Member
There was a problem hiding this comment.
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
zanieb
added a commit
that referenced
this pull request
Aug 15, 2024
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.
BurntSushi
reviewed
Aug 15, 2024
| ╰─▶ 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. |
zanieb
added a commit
that referenced
this pull request
Aug 16, 2024
…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)
This was referenced Aug 16, 2024
zanieb
added a commit
that referenced
this pull request
Aug 16, 2024
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An extension of #6090 that replaces #6066.
In brief,
NoVersionincompatibilities 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 birdrather thanyou require birdbirdinstead ofbird==0.1.0bird's requirements are unsatisfiableinstead ofbird cannot be used.your requirements are unsatisfiablewe sayyour workspace's requirements are unsatisfiablewhen in a workspace, since we're not in a "provide direct requirements" paradigm.As an annoying but minor implementation detail,
PackageRangenow requires access to thePubGrubReportFormatterso 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.