mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Remove deprecated flag --three
This commit is contained in:
@@ -144,8 +144,6 @@ activate a virtualenv, run `$ pipenv shell`).
|
||||
- A virtualenv will automatically be created, when one doesn\'t exist.
|
||||
- When no parameters are passed to `install`, all packages
|
||||
`[packages]` specified will be installed.
|
||||
- To initialize a virtual environment with system python3, run
|
||||
`$ pipenv --three`.
|
||||
- Otherwise, whatever virtualenv defaults to will be the default.
|
||||
|
||||
### Other Commands
|
||||
@@ -198,7 +196,6 @@ Usage
|
||||
[env var: PIPENV_SITE_PACKAGES]
|
||||
--python TEXT Specify which version of Python virtualenv
|
||||
should use.
|
||||
--three Use Python 3 when creating virtualenv.
|
||||
--clear Clears caches (pipenv, pip). [env var:
|
||||
PIPENV_CLEAR]
|
||||
-q, --quiet Quiet mode.
|
||||
|
||||
+2
-2
@@ -787,7 +787,7 @@ package manager, and hence unavailable for installation into virtual
|
||||
environments with ``pip``. In these cases, the virtual environment can
|
||||
be created with access to the system ``site-packages`` directory::
|
||||
|
||||
$ pipenv --three --site-packages
|
||||
$ pipenv --site-packages
|
||||
|
||||
To ensure that all ``pip``-installable components actually are installed
|
||||
into the virtual environment and system packages are only used for
|
||||
@@ -829,4 +829,4 @@ You can force Pipenv to use a different cache location by setting the environmen
|
||||
☤ Changing Default Python Versions
|
||||
----------------------------------
|
||||
|
||||
By default, Pipenv will initialize a project using whatever version of python the system has as default. Besides starting a project with the ``--python`` or ``--three`` flags, you can also use ``PIPENV_DEFAULT_PYTHON_VERSION`` to specify what version to use when starting a project when ``--python`` or ``--three`` aren't used.
|
||||
By default, Pipenv will initialize a project using whatever version of python the system has as default. Besides starting a project with the ``--python`` flag, you can also use ``PIPENV_DEFAULT_PYTHON_VERSION`` to specify what version to use when starting a project when ``--python`` isn't used.
|
||||
|
||||
@@ -331,7 +331,6 @@ Along with the basic install command, which takes the form::
|
||||
|
||||
The user can provide these additional parameters:
|
||||
|
||||
- ``--three`` — Performs the installation in a virtualenv using the system ``python3`` link.
|
||||
- ``--python`` — Performs the installation in a virtualenv using the provided Python interpreter.
|
||||
|
||||
.. warning:: None of the above commands should be used together. They are also
|
||||
|
||||
+2
-17
@@ -19,7 +19,6 @@ from pipenv.cli.options import (
|
||||
skip_lock_option,
|
||||
sync_options,
|
||||
system_option,
|
||||
three_option,
|
||||
uninstall_options,
|
||||
verbose_option,
|
||||
)
|
||||
@@ -205,11 +204,10 @@ def cli(
|
||||
err=True,
|
||||
)
|
||||
ctx.abort()
|
||||
# --python or --three was passed...
|
||||
if (state.python or state.three is not None) or state.site_packages:
|
||||
# --python was passed...
|
||||
if (state.python) or state.site_packages:
|
||||
ensure_project(
|
||||
state.project,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
warn=True,
|
||||
site_packages=state.site_packages,
|
||||
@@ -239,7 +237,6 @@ def install(state, **kwargs):
|
||||
do_install(
|
||||
state.project,
|
||||
dev=state.installstate.dev,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
pypi_mirror=state.pypi_mirror,
|
||||
system=state.system,
|
||||
@@ -286,7 +283,6 @@ def uninstall(ctx, state, all_dev=False, all=False, **kwargs):
|
||||
state.project,
|
||||
packages=state.installstate.packages,
|
||||
editable_packages=state.installstate.editables,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
system=state.system,
|
||||
lock=not state.installstate.skip_lock,
|
||||
@@ -330,7 +326,6 @@ def lock(ctx, state, **kwargs):
|
||||
# handled in do_lock
|
||||
ensure_project(
|
||||
state.project,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
pypi_mirror=state.pypi_mirror,
|
||||
warn=(not state.quiet),
|
||||
@@ -368,7 +363,6 @@ def lock(ctx, state, **kwargs):
|
||||
)
|
||||
@argument("shell_args", nargs=-1)
|
||||
@pypi_mirror_option
|
||||
@three_option
|
||||
@python_option
|
||||
@pass_state
|
||||
def shell(
|
||||
@@ -401,7 +395,6 @@ def shell(
|
||||
fancy = True
|
||||
do_shell(
|
||||
state.project,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
fancy=fancy,
|
||||
shell_args=shell_args,
|
||||
@@ -425,7 +418,6 @@ def run(state, command, args):
|
||||
state.project,
|
||||
command=command,
|
||||
args=args,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
pypi_mirror=state.pypi_mirror,
|
||||
)
|
||||
@@ -509,7 +501,6 @@ def check(
|
||||
|
||||
do_check(
|
||||
state.project,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
system=state.system,
|
||||
db=db,
|
||||
@@ -539,7 +530,6 @@ def update(ctx, state, bare=False, dry_run=None, outdated=False, **kwargs):
|
||||
|
||||
ensure_project(
|
||||
state.project,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
pypi_mirror=state.pypi_mirror,
|
||||
warn=(not state.quiet),
|
||||
@@ -591,7 +581,6 @@ def update(ctx, state, bare=False, dry_run=None, outdated=False, **kwargs):
|
||||
do_sync(
|
||||
state.project,
|
||||
dev=state.installstate.dev,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
bare=bare,
|
||||
dont_upgrade=not state.installstate.keep_outdated,
|
||||
@@ -640,7 +629,6 @@ def run_open(state, module, *args, **kwargs):
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(
|
||||
state.project,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
validate=False,
|
||||
pypi_mirror=state.pypi_mirror,
|
||||
@@ -681,7 +669,6 @@ def sync(ctx, state, bare=False, user=False, unused=False, **kwargs):
|
||||
retcode = do_sync(
|
||||
state.project,
|
||||
dev=state.installstate.dev,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
bare=bare,
|
||||
dont_upgrade=(not state.installstate.keep_outdated),
|
||||
@@ -704,7 +691,6 @@ def sync(ctx, state, bare=False, user=False, unused=False, **kwargs):
|
||||
@option("--bare", is_flag=True, default=False, help="Minimal output.")
|
||||
@option("--dry-run", is_flag=True, default=False, help="Just output unneeded packages.")
|
||||
@verbose_option
|
||||
@three_option
|
||||
@python_option
|
||||
@pass_state
|
||||
def clean(state, dry_run=False, bare=False, user=False):
|
||||
@@ -713,7 +699,6 @@ def clean(state, dry_run=False, bare=False, user=False):
|
||||
|
||||
do_clean(
|
||||
state.project,
|
||||
three=state.three,
|
||||
python=state.python,
|
||||
dry_run=dry_run,
|
||||
system=state.system,
|
||||
|
||||
@@ -12,7 +12,6 @@ from pipenv.vendor.click import (
|
||||
echo,
|
||||
make_pass_decorator,
|
||||
option,
|
||||
secho,
|
||||
)
|
||||
from pipenv.vendor.click import types as click_types
|
||||
from pipenv.vendor.click_didyoumean import DYMMixin
|
||||
@@ -65,8 +64,6 @@ class State:
|
||||
self.quiet = False
|
||||
self.pypi_mirror = None
|
||||
self.python = None
|
||||
self.two = None
|
||||
self.three = None
|
||||
self.site_packages = None
|
||||
self.clear = False
|
||||
self.system = False
|
||||
@@ -316,28 +313,6 @@ def extra_pip_args(f):
|
||||
)(f)
|
||||
|
||||
|
||||
def three_option(f):
|
||||
def callback(ctx, param, value):
|
||||
state = ctx.ensure_object(State)
|
||||
if value is not None:
|
||||
secho(
|
||||
"WARNING: --three is deprecated! pipenv uses python3 by default",
|
||||
err=True,
|
||||
fg="yellow",
|
||||
)
|
||||
state.three = value
|
||||
return value
|
||||
|
||||
return option(
|
||||
"--three",
|
||||
is_flag=True,
|
||||
default=None,
|
||||
help="Use Python 3 when creating virtualenv. Deprecated",
|
||||
callback=callback,
|
||||
expose_value=False,
|
||||
)(f)
|
||||
|
||||
|
||||
def python_option(f):
|
||||
def callback(ctx, param, value):
|
||||
state = ctx.ensure_object(State)
|
||||
@@ -562,7 +537,6 @@ def common_options(f):
|
||||
f = verbose_option(f)
|
||||
f = quiet_option(f)
|
||||
f = clear_option(f)
|
||||
f = three_option(f)
|
||||
f = python_option(f)
|
||||
return f
|
||||
|
||||
|
||||
+12
-48
@@ -318,9 +318,9 @@ def find_a_system_python(line):
|
||||
return python_entry
|
||||
|
||||
|
||||
def ensure_python(project, three=None, python=None):
|
||||
def ensure_python(project, python=None):
|
||||
# Runtime import is necessary due to the possibility that the environments module may have been reloaded.
|
||||
if project.s.PIPENV_PYTHON and python is False and three is None:
|
||||
if project.s.PIPENV_PYTHON and python is False:
|
||||
python = project.s.PIPENV_PYTHON
|
||||
|
||||
def abort(msg=""):
|
||||
@@ -336,10 +336,8 @@ def ensure_python(project, three=None, python=None):
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
project.s.USING_DEFAULT_PYTHON = three is None and not python
|
||||
project.s.USING_DEFAULT_PYTHON = not python
|
||||
# Find out which python is desired.
|
||||
if not python:
|
||||
python = convert_three_to_python(three, python)
|
||||
if not python:
|
||||
python = project.required_python_version
|
||||
if not python:
|
||||
@@ -446,9 +444,7 @@ def ensure_python(project, three=None, python=None):
|
||||
return path_to_python
|
||||
|
||||
|
||||
def ensure_virtualenv(
|
||||
project, three=None, python=None, site_packages=None, pypi_mirror=None
|
||||
):
|
||||
def ensure_virtualenv(project, python=None, site_packages=None, pypi_mirror=None):
|
||||
"""Creates a virtualenv, if one doesn't exist."""
|
||||
|
||||
def abort():
|
||||
@@ -459,7 +455,7 @@ def ensure_virtualenv(
|
||||
# Ensure environment variables are set properly.
|
||||
ensure_environment()
|
||||
# Ensure Python is available.
|
||||
python = ensure_python(project, three=three, python=python)
|
||||
python = ensure_python(project, python=python)
|
||||
if python is not None and not isinstance(python, str):
|
||||
python = python.path.as_posix()
|
||||
# Create the virtualenv.
|
||||
@@ -481,11 +477,11 @@ def ensure_virtualenv(
|
||||
# If interrupted, cleanup the virtualenv.
|
||||
cleanup_virtualenv(project, bare=False)
|
||||
sys.exit(1)
|
||||
# If --python or --three were passed...
|
||||
elif (python) or (three is not None) or (site_packages is not None):
|
||||
# If --python or was passed...
|
||||
elif (python) or (site_packages is not None):
|
||||
project.s.USING_DEFAULT_PYTHON = False
|
||||
# Ensure python is installed before deleting existing virtual env
|
||||
python = ensure_python(project, three=three, python=python)
|
||||
python = ensure_python(project, python=python)
|
||||
if python is not None and not isinstance(python, str):
|
||||
python = python.path.as_posix()
|
||||
|
||||
@@ -507,7 +503,6 @@ def ensure_virtualenv(
|
||||
# Call this function again.
|
||||
ensure_virtualenv(
|
||||
project,
|
||||
three=three,
|
||||
python=python,
|
||||
site_packages=site_packages,
|
||||
pypi_mirror=pypi_mirror,
|
||||
@@ -516,7 +511,6 @@ def ensure_virtualenv(
|
||||
|
||||
def ensure_project(
|
||||
project,
|
||||
three=None,
|
||||
python=None,
|
||||
validate=True,
|
||||
system=False,
|
||||
@@ -540,7 +534,6 @@ def ensure_project(
|
||||
if not system_or_exists:
|
||||
ensure_virtualenv(
|
||||
project,
|
||||
three=three,
|
||||
python=python,
|
||||
site_packages=site_packages,
|
||||
pypi_mirror=pypi_mirror,
|
||||
@@ -954,21 +947,6 @@ def do_install_dependencies(
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def convert_three_to_python(three, python):
|
||||
"""Converts a Three flag into a Python flag, and raises customer warnings
|
||||
in the process, if needed.
|
||||
"""
|
||||
if not python:
|
||||
if three is False:
|
||||
return "2"
|
||||
|
||||
elif three is True:
|
||||
return "3"
|
||||
|
||||
else:
|
||||
return python
|
||||
|
||||
|
||||
def _create_virtualenv_cmd(project, python, site_packages=False):
|
||||
cmd = [
|
||||
Path(sys.executable).absolute().as_posix(),
|
||||
@@ -2120,7 +2098,6 @@ def do_install(
|
||||
editable_packages=False,
|
||||
index_url=False,
|
||||
dev=False,
|
||||
three=False,
|
||||
python=False,
|
||||
pypi_mirror=None,
|
||||
system=False,
|
||||
@@ -2151,7 +2128,6 @@ def do_install(
|
||||
# Ensure that virtualenv is available and pipfile are available
|
||||
ensure_project(
|
||||
project,
|
||||
three=three,
|
||||
python=python,
|
||||
system=system,
|
||||
warn=True,
|
||||
@@ -2483,7 +2459,6 @@ def do_uninstall(
|
||||
project,
|
||||
packages=None,
|
||||
editable_packages=None,
|
||||
three=None,
|
||||
python=False,
|
||||
system=False,
|
||||
lock=False,
|
||||
@@ -2498,7 +2473,7 @@ def do_uninstall(
|
||||
if project.s.PIPENV_USE_SYSTEM:
|
||||
system = True
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(project, three=three, python=python, pypi_mirror=pypi_mirror)
|
||||
ensure_project(project, python=python, pypi_mirror=pypi_mirror)
|
||||
# Uninstall all dependencies, if --all was provided.
|
||||
if not any([packages, editable_packages, all_dev, all]):
|
||||
raise exceptions.PipenvUsageError("No package provided!", ctx=ctx)
|
||||
@@ -2642,13 +2617,10 @@ def do_uninstall(
|
||||
sys.exit(int(failure))
|
||||
|
||||
|
||||
def do_shell(
|
||||
project, three=None, python=False, fancy=False, shell_args=None, pypi_mirror=None
|
||||
):
|
||||
def do_shell(project, python=False, fancy=False, shell_args=None, pypi_mirror=None):
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(
|
||||
project,
|
||||
three=three,
|
||||
python=python,
|
||||
validate=False,
|
||||
pypi_mirror=pypi_mirror,
|
||||
@@ -2802,7 +2774,7 @@ def do_run_posix(project, script, command, env):
|
||||
)
|
||||
|
||||
|
||||
def do_run(project, command, args, three=None, python=False, pypi_mirror=None):
|
||||
def do_run(project, command, args, python=False, pypi_mirror=None):
|
||||
"""Attempt to run command either pulling from project or interpreting as executable.
|
||||
|
||||
Args are appended to the command in [scripts] section of project if found.
|
||||
@@ -2814,7 +2786,6 @@ def do_run(project, command, args, three=None, python=False, pypi_mirror=None):
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(
|
||||
project,
|
||||
three=three,
|
||||
python=python,
|
||||
validate=False,
|
||||
pypi_mirror=pypi_mirror,
|
||||
@@ -2858,7 +2829,6 @@ def do_run(project, command, args, three=None, python=False, pypi_mirror=None):
|
||||
|
||||
def do_check(
|
||||
project,
|
||||
three=None,
|
||||
python=False,
|
||||
system=False,
|
||||
db=None,
|
||||
@@ -2879,7 +2849,6 @@ def do_check(
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(
|
||||
project,
|
||||
three=three,
|
||||
python=python,
|
||||
validate=False,
|
||||
warn=False,
|
||||
@@ -3225,7 +3194,6 @@ def do_graph(project, bare=False, json=False, json_tree=False, reverse=False):
|
||||
def do_sync(
|
||||
project,
|
||||
dev=False,
|
||||
three=None,
|
||||
python=None,
|
||||
bare=False,
|
||||
dont_upgrade=False,
|
||||
@@ -3245,7 +3213,6 @@ def do_sync(
|
||||
# Ensure that virtualenv is available if not system.
|
||||
ensure_project(
|
||||
project,
|
||||
three=three,
|
||||
python=python,
|
||||
validate=False,
|
||||
system=system,
|
||||
@@ -3279,7 +3246,6 @@ def do_sync(
|
||||
|
||||
def do_clean(
|
||||
project,
|
||||
three=None,
|
||||
python=None,
|
||||
dry_run=False,
|
||||
bare=False,
|
||||
@@ -3289,9 +3255,7 @@ def do_clean(
|
||||
# Ensure that virtualenv is available.
|
||||
from pipenv.patched.pip._vendor.packaging.utils import canonicalize_name
|
||||
|
||||
ensure_project(
|
||||
project, three=three, python=python, validate=False, pypi_mirror=pypi_mirror
|
||||
)
|
||||
ensure_project(project, python=python, validate=False, pypi_mirror=pypi_mirror)
|
||||
ensure_lockfile(project, pypi_mirror=pypi_mirror)
|
||||
# Make sure that the virtualenv's site packages are configured correctly
|
||||
# otherwise we may end up removing from the global site packages directory
|
||||
|
||||
@@ -124,7 +124,7 @@ class Setting:
|
||||
|
||||
This can be set to a version string, e.g. ``3.9``, or a path. Default is to use
|
||||
whatever Python Pipenv is installed under (i.e. ``sys.executable``). Command
|
||||
line flags (e.g. ``--python`` and ``--three``) are prioritized over
|
||||
line flags (e.g. ``--python``) are prioritized over
|
||||
this configuration.
|
||||
"""
|
||||
|
||||
|
||||
@@ -242,14 +242,6 @@ def test_pipenv_clear(pipenv_instance_pypi):
|
||||
assert 'Clearing caches' in c.stdout
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
def test_pipenv_three(pipenv_instance_pypi):
|
||||
with pipenv_instance_pypi() as p:
|
||||
c = p.pipenv('--three')
|
||||
assert c.returncode == 0
|
||||
assert 'Successfully created virtual environment' in c.stderr
|
||||
|
||||
|
||||
@pytest.mark.outdated
|
||||
def test_pipenv_outdated_prerelease(pipenv_instance_pypi):
|
||||
with pipenv_instance_pypi(chdir=True) as p:
|
||||
|
||||
Reference in New Issue
Block a user