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

@JacobHenner JacobHenner commented Jun 28, 2018

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.

@@ -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 {}

This comment has been minimized.

@techalchemy

techalchemy Jun 28, 2018
Member

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

This comment has been minimized.

@JacobHenner

JacobHenner Jun 28, 2018
Author Contributor

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 #2455
@JacobHenner JacobHenner force-pushed the JacobHenner:bugfix/2455-virtualenv-pypi-mirror branch from f050a5a to 0503c20 Jun 28, 2018
@techalchemy
Copy link
Member

@techalchemy techalchemy commented Jun 28, 2018

Thanks!

@techalchemy techalchemy merged commit 3d8e93a into pypa:master Jun 28, 2018
0 of 2 checks passed
0 of 2 checks passed
buildkite/pipenv Build #621 started
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
@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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.