mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-27 18:36:44 +00:00
Add an UnusableDependencies incompatibility kind and use for conflicting versions (#424)
Addresses https://github.com/astral-sh/puffin/issues/309#issuecomment-1792648969 Similar to #338 this throws an error when merging versions results in an empty set. Instead of propagating that error, we capture it and return a new dependency type of `Unusable`. Unusable dependencies are a new incompatibility kind which includes an arbitrary "reason" string that we present to the user. Adding a new incompatibility kind requires changes to the vendored pubgrub crate. We could use this same incompatibility kind for conflicting urls as in #284 which should allow the solver to backtrack to another valid version instead of failing (see #425). Unlike #383 this does not require changes to PubGrub's package mapping model. I think in the long run we'll want PubGrub to accept multiple versions per package to solve this specific issue, but we're interested in it being merged upstream first. This pull request is just using the issue as a simple case to explore adding a new incompatibility type. We may or may not be able convince them to add this new incompatibility type upstream. As discussed in https://github.com/pubgrub-rs/pubgrub/issues/152, we may want a more general incompatibility kind instead which can be used for arbitrary problems. An upstream pull request has been opened for discussion at https://github.com/pubgrub-rs/pubgrub/pull/153. Related to: - https://github.com/pubgrub-rs/pubgrub/issues/152 - #338 - #383 --------- Co-authored-by: konsti <konstin@mailbox.org>
This commit is contained in:
parent
832058dbba
commit
0d9d4f9fca
7 changed files with 61 additions and 10 deletions
|
|
@ -44,6 +44,9 @@ pub enum ResolveError {
|
|||
#[error("Conflicting URLs for package `{0}`: {1} and {2}")]
|
||||
ConflictingUrls(PackageName, String, String),
|
||||
|
||||
#[error("Conflicting versions for `{0}`: {1}")]
|
||||
ConflictingVersions(String, String),
|
||||
|
||||
#[error("Package `{0}` attempted to resolve via URL: {1}. URL dependencies must be expressed as direct requirements or constraints. Consider adding `{0} @ {1}` to your dependencies or constraints file.")]
|
||||
DisallowedUrl(PackageName, Url),
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue