Skip to content
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

Get rid full file path #7898

Closed
wants to merge 11 commits into from
Closed

Conversation

microcat49
Copy link

@microcat49 microcat49 commented Mar 25, 2020

Fixes and closes #7815

This change will switch from using full file path for wheel to using just the name of the package.

Copy link
Member

@pfmoore pfmoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this should include tests.

src/pip/_internal/operations/prepare.py Outdated Show resolved Hide resolved
@pradyunsg pradyunsg added S: awaiting response Waiting for a response/more information type: enhancement Improvements to functionality labels Mar 26, 2020
@pradyunsg
Copy link
Member

Thanks for the PR @microcat49! If you could respond to the review comments when you have the time to, that'd be great! :)

@microcat49
Copy link
Author

Hey @pradyunsg sorry about the delayed response I'm still looking into how I could fix the issue raised in the review comment.

@pradyunsg
Copy link
Member

@microcat49 thanks for the quick response! No hurries. Feel free to ask follow up questions if you have any. :)

Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments and this definitely needs tests.

src/pip/_internal/operations/prepare.py Outdated Show resolved Hide resolved
src/pip/_internal/req/req_install.py Outdated Show resolved Hide resolved
news/7815.bugfix Outdated Show resolved Hide resolved
Copy link
Contributor

@McSinyx McSinyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicking, please don't take me too seriously though!

logger.info('Processing %s (cached)', req.link.filename)
else:
logger.info('Processing %s', req.link.file_path)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this newline is needed.



class TestInstallRequirementWheelCache(object):

Copy link
Contributor

@McSinyx McSinyx Mar 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither is this. It is, I was wrong.

Comment on lines +120 to +124
"""
This test to make sure that file is able to tell when a link is
from the wheel cache.
"""

Copy link
Contributor

@McSinyx McSinyx Mar 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's pip policy toward PEP 257? I see this style of docstring all over functional tests. Is it time to start complying with the PEP?

Comment on lines +142 to +146
"""
This test to make sure that file is able to tell when a link is not
from the wheel cache.
"""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this.

Comment on lines +277 to +280
if self._wheel_cache is not None and self.link is not None:
return bool(self._wheel_cache.cache_dir in self.link.file_path)
else:
return False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this is safer (duck-typing) and clearer:

Suggested change
if self._wheel_cache is not None and self.link is not None:
return bool(self._wheel_cache.cache_dir in self.link.file_path)
else:
return False
try:
return self._wheel_cache.cache_dir in self.link.file_path
except AttributeError:
return False

Also please mind the docstring.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AttributeError suggestion is unclear to me. There are too many attribute access and it’s confusing which one causes the exception. The original implementation is more explicit for me (but the bool() cast can be removed as suggested).

@sbidoul
Copy link
Member

sbidoul commented Mar 29, 2020

I am not convinced it is worthwhile to continue this PR without a preliminary refactoring.
See #7815 (comment) and following comments.
Also note #7612 already has some refactoring of the caching part in populate_link.

@microcat49
Copy link
Author

Hey @uranusjr @sbidoul @McSinyx Please let me know if you'd like me to move forward with this PR? I'm happy to continue it just seems like there is disagreements whether this PR should go through. I wanted to check to make sure before I continued?

@BrownTruck
Copy link
Contributor

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 master branch into this pull request or rebase this pull request against master then it will be eligible for code review and hopefully merging!

@BrownTruck BrownTruck added the needs rebase or merge PR has conflicts with current master label Mar 31, 2020
@pradyunsg
Copy link
Member

Closing due to lack of movement here. Please feel free to file a new PR if you want to get the ball rolling again! :)

@pradyunsg pradyunsg closed this Feb 26, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs rebase or merge PR has conflicts with current master S: awaiting response Waiting for a response/more information type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't print full paths for cached wheels when using them
7 participants