Skip to content

Commit

Permalink
Merge pull request #7225 from pradyunsg/show-better-urls
Browse files Browse the repository at this point in the history
Show shorter details of the URL when downloading from PyPI
  • Loading branch information
pradyunsg authored Oct 17, 2019
2 parents 3b8e2f3 + af0c5b5 commit 8c50c8a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/7225.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Show only the filename (instead of full URL), when downloading from PyPI.
2 changes: 1 addition & 1 deletion src/pip/_internal/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def written_chunks(chunks):

progress_indicator = _progress_indicator

if link.netloc == PyPI.netloc:
if link.netloc == PyPI.file_storage_domain:
url = link.show_url
else:
url = link.url_without_fragment
Expand Down
9 changes: 8 additions & 1 deletion tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def test_basic_install_from_pypi(script):
"""
Test installing a package from PyPI.
"""
result = script.pip('install', '-vvv', 'INITools==0.2')
result = script.pip('install', 'INITools==0.2')
egg_info_folder = (
script.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion
)
Expand All @@ -238,6 +238,13 @@ def test_basic_install_from_pypi(script):
assert "Looking in indexes: " not in result.stdout
assert "Looking in links: " not in result.stdout

# Ensure that we don't print the full URL.
# The URL should be trimmed to only the last part of the path in it,
# when installing from PyPI. The assertion here only checks for
# `https://` since that's likely to show up if we're not trimming in
# the correct circumstances.
assert "https://" not in result.stdout


def test_basic_editable_install(script):
"""
Expand Down

0 comments on commit 8c50c8a

Please sign in to comment.