Skip to content
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

Avoid redundant enumeration of all package versions during solve failure #4075

Closed
zanieb opened this issue Jun 5, 2024 · 2 comments · Fixed by #9885
Closed

Avoid redundant enumeration of all package versions during solve failure #4075

zanieb opened this issue Jun 5, 2024 · 2 comments · Fixed by #9885
Labels
error messages Messaging when something goes wrong

Comments

@zanieb
Copy link
Member

zanieb commented Jun 5, 2024

error: Because the current Python version (3.9.6) does not satisfy Python>=3.11,<4.0 and all versions of rooster-blue depend on Python>=3.11,<4.0, we can conclude that all versions of rooster-blue cannot be used.
And because only the following versions of rooster-blue are available:
    rooster-blue==0.0.1
    rooster-blue==0.0.2
    rooster-blue==0.0.3
    rooster-blue==0.0.4
and you require rooster-blue, we can conclude that the requirements are unsatisfiable.

There's no reason for this message to be so verbose. We already said all versions of rooster-blue cannot be used. The conclusion could be:

And because you require rooster-blue, we can conclude that the requirements are unsatisfiable.
@charliermarsh charliermarsh added the error messages Messaging when something goes wrong label Jun 5, 2024
@charliermarsh
Copy link
Member

How would you go about solving this?

@zanieb
Copy link
Member Author

zanieb commented Jun 5, 2024

I'm not sure. I think the latter half comes from

fn and_explain_external(
&self,
external: &External<PubGrubPackage, Range<Version>, UnavailableReason>,
current_terms: &Map<PubGrubPackage, Term<Range<Version>>>,
) -> String {
let external = self.format_external(external);
let terms = self.format_terms(current_terms);
format!(
"And because {}we can conclude that {}",
Padded::from_string("", &external, ", "),
Padded::from_string("", &terms, "."),
)
}

which doesn't have a obvious way to inspect that we previously concluded that "all versions cannot be used".

Maybe we don't need to know that we said that previously and instead we should just have better handling at

// Complex case, there are multiple ranges
} else {
format!(
"only the following versions of {} {}",
package,
PackageRange::available(package, &complement)
)
}

and collapse that to "all versions" when we see we're enumerating all of the available versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Messaging when something goes wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants