diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2013-11-22 14:30:34 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2013-11-22 14:30:34 (GMT) |
commit | 8fbdb097cfc6a838a6a447e4a6c7ad497c392ad6 (patch) | |
tree | d43dde2807aa97f3ec9c717121cdb72bee8898c2 /Doc | |
parent | 0b61ef6f797abf9d573573710b2f1bd8d1b4e45b (diff) | |
download | cpython-8fbdb097cfc6a838a6a447e4a6c7ad497c392ad6.zip cpython-8fbdb097cfc6a838a6a447e4a6c7ad497c392ad6.tar.gz cpython-8fbdb097cfc6a838a6a447e4a6c7ad497c392ad6.tar.bz2 |
Close #19552: venv and pyvenv ensurepip integration
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/venv.rst | 15 | ||||
-rw-r--r-- | Doc/using/venv-create.inc | 10 |
2 files changed, 22 insertions, 3 deletions
diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst index 042ed8e..efc2137 100644 --- a/Doc/library/venv.rst +++ b/Doc/library/venv.rst @@ -85,7 +85,8 @@ The high-level method described above makes use of a simple API which provides mechanisms for third-party virtual environment creators to customize environment creation according to their needs, the :class:`EnvBuilder` class. -.. class:: EnvBuilder(system_site_packages=False, clear=False, symlinks=False, upgrade=False) +.. class:: EnvBuilder(system_site_packages=False, clear=False, \ + symlinks=False, upgrade=False, with_pip=False) The :class:`EnvBuilder` class accepts the following keyword arguments on instantiation: @@ -105,6 +106,12 @@ creation according to their needs, the :class:`EnvBuilder` class. environment with the running Python - for use when that Python has been upgraded in-place (defaults to ``False``). + * ``with_pip`` -- a Boolean value which, if True, ensures pip is + installed in the virtual environment + + .. versionchanged:: 3.4 + Added the ``with_pip`` parameter + Creators of third-party virtual environment tools will be free to use the provided ``EnvBuilder`` class as a base class. @@ -201,11 +208,15 @@ creation according to their needs, the :class:`EnvBuilder` class. There is also a module-level convenience function: -.. function:: create(env_dir, system_site_packages=False, clear=False, symlinks=False) +.. function:: create(env_dir, system_site_packages=False, clear=False, \ + symlinks=False, with_pip=False) Create an :class:`EnvBuilder` with the given keyword arguments, and call its :meth:`~EnvBuilder.create` method with the *env_dir* argument. + .. versionchanged:: 3.4 + Added the ``with_pip`` parameter + An example of extending ``EnvBuilder`` -------------------------------------- diff --git a/Doc/using/venv-create.inc b/Doc/using/venv-create.inc index 706ac5d..868bbc8 100644 --- a/Doc/using/venv-create.inc +++ b/Doc/using/venv-create.inc @@ -25,7 +25,7 @@ or equivalently:: The command, if run with ``-h``, will show the available options:: usage: pyvenv [-h] [--system-site-packages] [--symlinks] [--clear] - [--upgrade] ENV_DIR [ENV_DIR ...] + [--upgrade] [--without-pip] ENV_DIR [ENV_DIR ...] Creates virtual Python environments in one or more target directories. @@ -43,6 +43,11 @@ The command, if run with ``-h``, will show the available options:: raised. --upgrade Upgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place. + --without-pip Skips installing or upgrading pip in the virtual + environment (pip is bootstrapped by default) + +.. versionchanged:: 3.4 + Installs pip by default, added the ``--without-pip`` option If the target directory already exists an error will be raised, unless the ``--clear`` or ``--upgrade`` option was provided. @@ -51,6 +56,9 @@ The created ``pyvenv.cfg`` file also includes the ``include-system-site-packages`` key, set to ``true`` if ``venv`` is run with the ``--system-site-packages`` option, ``false`` otherwise. +Unless the ``--without-pip`` option is given, :mod:`ensurepip` will be +invoked to bootstrap ``pip`` into the virtual environment. + Multiple paths can be given to ``pyvenv``, in which case an identical virtualenv will be created, according to the given options, at each provided path. |