-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Address #5874: Prefer candidates with allowed hashes #6699
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cjerdonek
force-pushed
the
issue-5874-hash-checking
branch
from
July 11, 2019 09:30
f44912a
to
ebff940
Compare
xavfernandez
approved these changes
Jul 12, 2019
Nice and clear 👍 |
Thanks, @xavfernandez! 😊 |
chrahunt
reviewed
Jul 13, 2019
cjerdonek
force-pushed
the
issue-5874-hash-checking
branch
from
July 14, 2019 09:53
ebff940
to
74504ff
Compare
Merging so I can work on a couple nice-to-have follow-ups to this. |
cjerdonek
added
C: finder
PackageFinder and index related code
C: requirement file
Using `requirements.txt`
type: enhancement
Improvements to functionality
labels
Jul 14, 2019
This was referenced Jul 14, 2019
lock
bot
added
the
auto-locked
Outdated issues that have been locked by automation
label
Aug 15, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
auto-locked
Outdated issues that have been locked by automation
C: finder
PackageFinder and index related code
C: requirement file
Using `requirements.txt`
type: enhancement
Improvements to functionality
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a follow-on to PR #6687 that addresses issue #5874 (and the same issue #3634), which is to prefer candidates for install that match a user-provided hash (aka the allowed hashes).
PR #6687 makes this PR possible because it added support for creating a new
CandidateEvaluator
for eachRequirement
(since the allowed hashes can vary per requirement).This PR uses an approach different from PR #6464. Instead of filtering the candidates post hoc inside
get_best_candidate()
and after sorting by preference, the approach in this PR usesindex.py
's concept of "applicable" candidates combined with using the sort preference itself to do the choosing. First, it uses the allowed hashes to determine which candidates are applicable: if at least one link has a matching hash, then links with non-matching hashes are considered not applicable and filtered out of consideration (and links with matching hashes or no hash are applicable and so are kept). Otherwise, if no link has a matching hash, the list of applicable links is kept the same and no links are filtered out for hash reasons. Then, in the phase of sorting applicable candidates, links with matching hashes are preferred over links whose hash doesn't match (or that don't have a hash).In a follow-on PR, I can implement @dstufft's suggestion of logging a warning if a link is more preferred but has no hash listed: #5874 (comment)