-
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
Don't print full paths for cached wheels when using them #7815
Comments
Could I take this one? I think I know how to fix it. |
Go ahead! I’d be very interested in learning what the problem is. |
Unless I miss something (which is likely), I don't think the PyYAML wheel should be logged with Processing at all, i.e. it cannot appear as a (local) file to the preparer. However, there is some sort of black magic happening behind the scene that caused a cached wheel to be seen as a file, and I'm not sure how that only happens to that particular wheel. |
Probably because PyYAML has no wheel for linux on PyPI and that cached wheel is the result of a local build. |
I think this issue is a bit deeper than simply changing the file name displayed. @McSinyx has a point here. Looking at the code where pip/src/pip/_internal/operations/prepare.py Lines 375 to 382 in 4381493
We see that it tests if req.link.scheme is a file. When the original link was a direct url, link may point to a local wheel in cache which is why we end up with the cache entry path in the log. Is it not better to test for It could look like this: assert req.link
link = req.link
# TODO: Breakup into smaller functions
if req.original_link and req.original_link.is_file:
path = req.original_link.file_path
logger.info('Processing %s', display_path(path))
else:
logger.info('Collecting %s', req.req or req)
if link.is_file and link.is_wheel and link != req.original_link:
with indent_log():
logger.info("Using cached wheel %s", link.filename)
logger.debug("Cached wheel is located at %s", link.file_path) The user-visible result looks much more coherent like this. Also I note that I personally sometimes find useful to have the full path of the cached wheel displayed. That could remain as a debug-level log though. |
Since the info is to notice users on what's being carried out, does it make sense to separate the two cases where
|
It does make sense, but the current code base does not make the distinction. It will be some significant refactoring to achieve this 😞 |
Is it a welcoming change? I mean not just to solve this particular issue but to improve the codebase in general. To handle GH-825 I may touch many things done before/during dependency resolution. |
Code base improvement is definitely welcomed. I would suggest filing the refactorings as a separate PR from the actual feature, so the feature does not unnecessarily block the refactoring. |
@uranusjr would it make sense to first move the cache check from BTW there is a significant refactoring of the cache access in #7612 so I hope we can get that one in before going further in this area of the code base. |
Actually I think it should be moved further out, either when the resolver is sure the link will be installed, or when the link is actually used to install. See #7801 and its linked issues for discussion. The reason is unrelated to this issue, but would incidentally provide a solution 😉 |
Environment
Description
Currently, during installation, occasionally prints "Processing <full-wheel-name-in-cache>"
Expected behavior
pip should say "Processing <wheel-basename> (cached)" instead of printing the entire path.
How to Reproduce
Not sure what exact cache state needs to be but I can consistently reproduce this with:
pip install 'django-rest-swagger[reST]==0.3.10'
.Output
The text was updated successfully, but these errors were encountered: