Fix the 'no matching distributions' message being shown for installable packages - #14194
Fix the 'no matching distributions' message being shown for installable packages#141942ykwang wants to merge 7 commits into
Conversation
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Co-authored-by: Sepehr Rasouli <sepehrrasouli06@gmail.com>
ichard26
left a comment
There was a problem hiding this comment.
Hmm, the "have no matching distributions available" note would still be printed if there no distributions available from an index (or find-links), but the package is given by an direct URL requirement.
Generally, whenever an "explicit requirement -- a requirement that forces a particular distribution at a specific URI -- is specified, the finder is irrelevant since the resolver must use the explicit distributions.
ah, you're right. should names given by an explicit requirement be excluded from the hint then? |
|
I believe so. Not sure if there's an easy way to do that though. |
|
How about something like this? We could collect the names of causes = set()
explicit_names = set()
for req, _ in e.causes:
if isinstance(req, ExplicitRequirement):
explicit_names.add(req.name)
causes.add(req.name)
Finally, exclude ExplicitRequirement names from the no_candidates = {
c for c in causes - explicit_names if not self._has_any_candidates(c)
} |
|
I'd have to dig into the resolver implementation further to be sure, but that looks generally OK...? |
|
I've been meaning to review this, I'll get round to it soonish. |
What does this PR do?
Fixes #14193
Uses
find_all_candidates()so theno matching distributions available....message is only shown when the project has no candidates.PR Checklist:
Assisted-by: Codex (review)