Skip to content

Commit

Permalink
Allows overriding PIP_EXISTS_ACTION environment variable (it was fo…
Browse files Browse the repository at this point in the history
…rced to `w`) (#3738)

Allows overriding `PIP_EXISTS_ACTION` environment variable (it was forced to `w`)
  • Loading branch information
techalchemy authored Jun 4, 2019
2 parents ea47f38 + 72a19de commit c06ba76
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions news/3738.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Allow overriding PIP_EXISTS_ACTION evironment variable (value is passed to pip install).
Possible values here: https://pip.pypa.io/en/stable/reference/pip/#exists-action-option
Useful when you need to `PIP_EXISTS_ACTION=i` (ignore existing packages) - great for CI environments, where you need really fast setup.
4 changes: 2 additions & 2 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
PIPENV_CACHE_DIR, PIPENV_COLORBLIND, PIPENV_DEFAULT_PYTHON_VERSION,
PIPENV_DONT_USE_PYENV, PIPENV_HIDE_EMOJIS, PIPENV_MAX_SUBPROCESS,
PIPENV_PYUP_API_KEY, PIPENV_SHELL_FANCY, PIPENV_SKIP_VALIDATION,
PIPENV_YES, SESSION_IS_INTERACTIVE
PIPENV_YES, SESSION_IS_INTERACTIVE, PIP_EXISTS_ACTION
)
from .project import Project, SourceNotFound
from .utils import (
Expand Down Expand Up @@ -1513,7 +1513,7 @@ def pip_install(
"PIP_DESTINATION_DIR": vistir.misc.fs_str(
cache_dir.joinpath("pkgs").as_posix()
),
"PIP_EXISTS_ACTION": vistir.misc.fs_str("w"),
"PIP_EXISTS_ACTION": vistir.misc.fs_str(PIP_EXISTS_ACTION or "w"),
"PATH": vistir.misc.fs_str(os.environ.get("PATH")),
}
if src:
Expand Down
7 changes: 6 additions & 1 deletion pipenv/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ def _is_env_truthy(name):
NOTE: This only affects the ``install`` and ``uninstall`` commands.
"""

PIP_EXISTS_ACTION = os.environ.get("PIP_EXISTS_ACTION", "w")
"""Specifies the value for pip's --exists-action option
Defaullts to (w)ipe
"""

PIPENV_RESOLVE_VCS = _is_env_truthy(os.environ.get("PIPENV_RESOLVE_VCS", 'true'))
"""Tells Pipenv whether to resolve all VCS dependencies in full.
Expand All @@ -242,7 +248,6 @@ def _is_env_truthy(name):
approach, you may set this to '0', 'off', or 'false'.
"""


PIPENV_PYUP_API_KEY = os.environ.get(
"PIPENV_PYUP_API_KEY", "1ab8d58f-5122e025-83674263-bc1e79e0"
)
Expand Down

0 comments on commit c06ba76

Please sign in to comment.