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

Use --pypi-mirror during virtualenv initialization #2462

Merged

Conversation

JacobHenner
Copy link
Contributor

Adds support for the --pypi-mirror parameter for all operations which
may result in a virtualenv initialization.

When a virtualenv is initialized, pip attempts to download several
dependencies from PyPI. If PyPI is unavailable, virtualenv silently uses
local packages instead, which is acceptable in most cases. However, in
some environments connection attempts to PyPI will stall rather than
fail, causing a pipenv timeout. By using the mirror specified by
--pypi-mirror, we can ensure virtualenv will attempt to download
dependencies from an accessible mirror instead of PyPI.

pipenv/core.py Outdated
@@ -933,7 +934,8 @@ def do_create_virtualenv(python=None, site_packages=False):
# Actually create the virtualenv.
with spinner():
try:
c = delegator.run(cmd, block=False, timeout=PIPENV_TIMEOUT)
pip_config = {'PIP_INDEX_URL': pypi_mirror} if pypi_mirror else {}
Copy link
Member

Choose a reason for hiding this comment

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

from .utils import fs_str
pip_config = {'PIP_INDEX_URL': fs_str(pypi_mirror)} if pypi_mirror else {}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been revised

Adds support for the --pypi-mirror parameter for all operations which
may result in a virtualenv initialization.

When a virtualenv is initialized, pip attempts to download several
dependencies from PyPI. If PyPI is unavailable, virtualenv silently uses
local packages instead, which is acceptable in most cases. However, in
some environments connection attempts to PyPI will stall rather than
fail, causing a pipenv timeout. By using the mirror specified by
--pypi-mirror, we can ensure virtualenv will attempt to download
dependencies from an accessible mirror instead of PyPI.

- Fixes pypa#2455
@JacobHenner JacobHenner force-pushed the bugfix/2455-virtualenv-pypi-mirror branch from f050a5a to 0503c20 Compare June 28, 2018 18:23
@techalchemy
Copy link
Member

Thanks!

@techalchemy techalchemy merged commit 3d8e93a into pypa:master Jun 28, 2018
@techalchemy techalchemy added the Type: Bug 🐛 This issue is a bug. label Jun 28, 2018
@techalchemy techalchemy added this to the 2018.7.0 milestone Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 This issue is a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants