diff options
author | Paul Moore <p.f.moore@gmail.com> | 2022-06-26 16:49:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 16:49:03 (GMT) |
commit | aedb5194d590692918a8a070cbde2727fe178f49 (patch) | |
tree | e09f9bb36292ec146b86a1e86e52e72fd4c8c8b5 /Doc/library/venv.rst | |
parent | bb8b931385ba9df4e01f7dd3ce4575d49f60efdf (diff) | |
download | cpython-aedb5194d590692918a8a070cbde2727fe178f49.zip cpython-aedb5194d590692918a8a070cbde2727fe178f49.tar.gz cpython-aedb5194d590692918a8a070cbde2727fe178f49.tar.bz2 |
gh-94214: Add venv context.lib_path and document the context (GH-94221)
Diffstat (limited to 'Doc/library/venv.rst')
-rw-r--r-- | Doc/library/venv.rst | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst index b40bd41..3cf143d 100644 --- a/Doc/library/venv.rst +++ b/Doc/library/venv.rst @@ -177,6 +177,45 @@ creation according to their needs, the :class:`EnvBuilder` class. ``clear=True``, contents of the environment directory will be cleared and then all necessary subdirectories will be recreated. + The returned context object is a :class:`types.SimpleNamespace` with the + following attributes: + + * ``env_dir`` - The location of the virtual environment. Used for + ``__VENV_DIR__`` in activation scripts (see :meth:`install_scripts`). + + * ``env_name`` - The name of the virtual environment. Used for + ``__VENV_NAME__`` in activation scripts (see :meth:`install_scripts`). + + * ``prompt`` - The prompt to be used by the activation scripts. Used for + ``__VENV_PROMPT__`` in activation scripts (see :meth:`install_scripts`). + + * ``executable`` - The underlying Python executable used by the virtual + environment. This takes into account the case where a virtual environment + is created from another virtual environment. + + * ``inc_path`` - The include path for the virtual environment. + + * ``lib_path`` - The purelib path for the virtual environment. + + * ``bin_path`` - The script path for the virtual environment. + + * ``bin_name`` - The name of the script path relative to the virtual + environment location. Used for ``__VENV_BIN_NAME__`` in activation + scripts (see :meth:`install_scripts`). + + * ``env_exe`` - The name of the Python interpreter in the virtual + environment. Used for ``__VENV_PYTHON__`` in activation scripts + (see :meth:`install_scripts`). + + * ``env_exec_cmd`` - The name of the Python interpreter, taking into + account filesystem redirections. This can be used to run Python in + the virtual environment. + + + .. versionchanged:: 3.12 + The attribute ``lib_path`` was added to the context, and the context + object was documented. + .. versionchanged:: 3.11 The *venv* :ref:`sysconfig installation scheme <installation_paths>` |