-
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
Move wheel cache out of InstallRequirement #7801
Conversation
8603e9a
to
d998eaf
Compare
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
d998eaf
to
a8b88f0
Compare
Reviving this since there are some recent discussion around the wheel cache that makes this relevent, e.g. #7815 and its PR #7898. Currently the only use case for |
95cc048
to
2f436f2
Compare
p.s. The functional change is much less significant than the diff suggests. Half of them is simply removing the |
2f436f2
to
9df856a
Compare
9df856a
to
1514d85
Compare
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.
Did a cursory skim; LGTM in principle and implementation as well.
line, | ||
isolated=isolated, | ||
wheel_cache=wheel_cache, | ||
line, isolated=isolated, |
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.
nit: maintain existing style of one-per-line?
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’ll revert this if there’s anything else I should change.
@@ -256,6 +260,34 @@ def _check_skip_installed(self, req_to_install): | |||
self._set_req_to_reinstall(req_to_install) | |||
return None | |||
|
|||
def _populate_link(self, req): |
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.
Ooh, nice.
My brain is too fixed at thinking of populate_link as a method of InstallRequirement to have thought of doing this.
"""Ensure that if a link can be found for this, that it is found. | ||
|
||
Note that req.link may still be None - if Upgrade is False and the | ||
requirement is already installed. | ||
|
||
If preparer.require_hashes is True, don't use the wheel cache, because | ||
cached wheels, always built locally, have different hashes than the | ||
files downloaded from the index server and thus throw false hash | ||
mismatches. Furthermore, cached wheels at present have undeterministic | ||
contents due to file modification times. |
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.
The docstring could use an update.
"upgrade is false" -> requirement may be upgraded, based on upgrade-strategy
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.
This would couple this docstring with the implementation of _is_upgrade_allowed()
. Would it be better to simply mention “if _is_upgrade_allowed()
is True”?
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.
LGTM other than the minor comments made.
@sbidoul It’s only relevent to #7815 (comment) on where we should move the cache check to. Since the new resolver does not rely on |
Thanks @uranusjr! ^.^ |
In #7796 it was discussed how the “link is yanked” warning should not live inside the finder, since the new resolver may not actually end up using that found link. It was later discovered
InstallRequirement.populate_link()
is also not the correct location to log this, since anInstallRequirement
with link populated (i.e. turned into a candidate) may still be discarded when the resolver backtracks.The next idea is to put that logging code into a separate method for the resolver to call. However, the current implementation of
populate_link()
eagerly checks the link against the wheel cache, and replace the link if that cache hits. So to make the idea possible, the resolver also needs to invoke the cache look-up step.With that conclusion, this refactoring removed the
wheel_cache
attribute fromInstallRequirement
(since it is not used anywhere else), and puts it onResolver
instead.populate_link()
(the only usage of the wheel cache) is also moved to the resolver, and will be broken down in a later PR to move the yanked link warning.