From bd6f158220d095f8ee83bf418c91ee9016bd476d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 3 Jun 2017 18:47:09 -0400 Subject: [PATCH 1/2] default python 3 --- pipenv/cli.py | 8 +++++++- pipenv/environments.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 77a273b8..de33d4b1 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -24,7 +24,8 @@ from .utils import (convert_deps_from_pip, convert_deps_to_pip, is_required_vers proper_case, pep423_name, split_vcs) from .__version__ import __version__ from . import pep508checker, progress -from .environments import PIPENV_COLORBLIND, PIPENV_NOSPIN, PIPENV_SHELL_COMPAT, PIPENV_VENV_IN_PROJECT +from .environments import PIPENV_COLORBLIND, PIPENV_NOSPIN, PIPENV_SHELL_COMPAT, +from .environments import PIPENV_DEFAULT_THREE, PIPENV_VENV_IN_PROJECT # Backport required for earlier versions of Python. if sys.version_info < (3, 3): @@ -151,6 +152,11 @@ def ensure_virtualenv(three=None, python=None): def ensure_project(three=None, python=None, validate=True): """Ensures both Pipfile and virtualenv exist for the project.""" + + # Support for default three mode. + if PIPENV_DEFAULT_THREE: + three = True + ensure_pipfile(validate=validate) ensure_virtualenv(three=three, python=python) diff --git a/pipenv/environments.py b/pipenv/environments.py index f4cd81aa..bac0d2f8 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -22,6 +22,9 @@ PIPENV_NOSPIN = os.environ.get('PIPENV_NOSPIN') # Note: +1 because of a temporary bug in Pipenv. PIPENV_MAX_DEPTH = int(os.environ.get('PIPENV_MAX_DEPTH', '3')) + 1 +# Tells Pipenv to use Python three by default. +PIPENV_DEFAULT_THREE = os.environ.get('PIPENV_DEFAULT_THREE') + # Use shell compatibility mode when using venv in project mode. if PIPENV_VENV_IN_PROJECT: PIPENV_SHELL_COMPAT = True From 3a0ccdbfe01f666bfbdd2912736acf955c739192 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 3 Jun 2017 18:50:14 -0400 Subject: [PATCH 2/2] fix syntax error --- pipenv/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index de33d4b1..0566a6f7 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -24,7 +24,7 @@ from .utils import (convert_deps_from_pip, convert_deps_to_pip, is_required_vers proper_case, pep423_name, split_vcs) from .__version__ import __version__ from . import pep508checker, progress -from .environments import PIPENV_COLORBLIND, PIPENV_NOSPIN, PIPENV_SHELL_COMPAT, +from .environments import PIPENV_COLORBLIND, PIPENV_NOSPIN, PIPENV_SHELL_COMPAT from .environments import PIPENV_DEFAULT_THREE, PIPENV_VENV_IN_PROJECT # Backport required for earlier versions of Python.