-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Standardise link repr in logs #11083
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Standardize ``Link`` representation in logs. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
|
||
from pip._internal.cli.progress_bars import get_download_progress_renderer | ||
from pip._internal.exceptions import NetworkConnectionError | ||
from pip._internal.models.index import PyPI | ||
from pip._internal.models.link import Link | ||
from pip._internal.network.cache import is_from_cache | ||
from pip._internal.network.session import PipSession | ||
|
@@ -34,11 +33,7 @@ def _prepare_download( | |
) -> Iterable[bytes]: | ||
total_length = _get_http_response_size(resp) | ||
|
||
if link.netloc == PyPI.file_storage_domain: | ||
url = link.show_url | ||
else: | ||
url = link.url_without_fragment | ||
|
||
url = link.show_url | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only part of the change that I'm somewhat fine with, but I wonder if show_url should also mention the domain. That's something we can address in a follow up though. |
||
logged_url = redact_auth_from_url(url) | ||
|
||
if total_length: | ||
|
@@ -170,7 +165,7 @@ def __call__( | |
logger.critical( | ||
"HTTP error %s while getting %s", | ||
e.response.status_code, | ||
link, | ||
link.show_url, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be show_url but the entire URL. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So its still inconsistent link repr in logs - as described in the issue |
||
) | ||
raise | ||
|
||
|
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 don't think warnings/errors should present partial URLs, since its possible that the user has multiple indexes and needs to know which one the error is related to, without adding additional verbosity.