Omit project name from workspace errors (#4299)

## Summary

Because the workspace member itself is part of the resolution, adding
the workspace name for the project leads to confusing errors, like:

```
❯ cargo run lock --preview
   Compiling uv v0.2.11 (/Users/crmarsh/workspace/puffin/crates/uv)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.79s
     Running `/Users/crmarsh/workspace/puffin/target/debug/uv lock --preview`
  × No solution found when resolving dependencies:
  ╰─▶ Because only albatross==0.1.0 is available and albatross==0.1.0 depends on anyio<=3, we can conclude that all versions of albatross depend on anyio<=3.
      And because bird-feeder==1.0.0 depends on anyio>=4.3.0,<5 and only bird-feeder==1.0.0 is available, we can conclude that all versions of albatross and all versions of bird-feeder are incompatible.
      And because albatross depends on albatross and bird-feeder, we can conclude that the requirements are unsatisfiable.
```

(Notice "albatross depends on albatross".)
This commit is contained in:
Charlie Marsh 2024-06-13 18:32:51 -07:00 committed by GitHub
parent cacd1a2b5a
commit db84825908
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 8 additions and 62 deletions

View file

@ -192,13 +192,6 @@ impl Workspace {
.collect()
}
/// If there is a package at the workspace root, return it.
pub fn root_member(&self) -> Option<&WorkspaceMember> {
self.packages
.values()
.find(|package| package.root == self.root)
}
/// The path to the workspace root, the directory containing the top level `pyproject.toml` with
/// the `uv.tool.workspace`, or the `pyproject.toml` in an implicit single workspace project.
pub fn root(&self) -> &PathBuf {