-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Description
I'm trying to write a fix #12973. But it occurred to me that I don't understand what the intention of this preference is. I always assumed it meant "the requirement pointed to a file, url, or VCS".
direct was added in #10032, but in it there is no discussion of direct beyond the added docstring "Prefer if any of the known requirements is "direct", e.g. points to an explicit URL."
I'm fairly confident the code didn't do anything at the time:
lookups = (r.get_candidate_lookup() for r, _ in information[identifier])
candidate, ireqs = zip(*lookups)
...
direct = candidate is not Noneget_candidate_lookup always returns a tuple of (None, None), (Candidate, None), or (None, InstallRequirement). So assuming the simplest case where there is just 1 tuple of (None, None) we get a tuple:
>>> candidate, ireqs = zip(*((None, None), ))
>>> candidate
(None,)
So the candidate could never be None.
But let's assume we actually get a Candidate in the candidate tuple, this represents that resolution has already found a candidate for this requirement, not anything specific about the requirement.
So my question is, is that intentional? And if so, what is the expected benefit to the resolution process? Or is it meant to act like how I assumed it would act?
Code of Conduct
- I agree to follow the PSF Code of Conduct.