-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add allow_all_prereleases to CandidateEvaluator's constructor #6514
Add allow_all_prereleases to CandidateEvaluator's constructor #6514
Conversation
Is there a reason to introduce |
I don't think "introduced" is the right word because the method already existed before as But yes, I think there are good reasons to put it there. For one, it hides complexity away from Finally, it makes things nice and clean on the def find_candidates(self, project_name, specifier=None):
candidates = self.find_all_candidates(project_name)
return self.candidate_evaluator.make_found_candidates(
candidates, specifier=specifier,
) Would it help to give it a better, more descriptive name (e.g. |
That makes a lot of sense, thanks for the explanation! Reading the implementation again, I think what bothers me is not moving constructing function, but that Maybe it’d be possible to remove |
Yes, I agree with you re: the relationship between those two classes. There is some circularity which isn't ideal. At the same time, Another possibility to break the circularity would be for Re: removing |
I agree that passing an opaque callable is not very worthwhile. I think the interfacing problem of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pondered a bit and now feel this is a good design. 💡
Okay, thanks much for taking the time to review and discuss. |
This PR is another follow-up to PR #6424 (the previous follow-up was PR #6511). It adds
allow_all_prereleases
to the list of arguments accepted byCandidateEvaluator
's constructor, as suggested first in this comment to PR #6424: #6424 (comment) Doing this lets us eliminate another argument toPackageFinder
's contructor, since it's now taken care of by thecandidate_evaluator
argument.This PR also simplifies
CandidateEvaluator
by moving the creation ofInstallationCandidate
objects back toPackageFinder
, which was made possible by the refactor in PR #6484.In this way,
CandidateEvaluator
takes on more of the evaluating / filtering responsibility, while the state stays withPackageFinder
.