Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f224a0

Browse files
authored
Touch up venv docs (GH-14922)
1 parent c6fd6c8 commit 2f224a0

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

Doc/library/venv.rst

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Creating virtual environments
4747
A virtual environment is a directory tree which contains Python executable
4848
files and other files which indicate that it is a virtual environment.
4949

50-
Common installation tools such as ``Setuptools`` and ``pip`` work as
50+
Common installation tools such as setuptools_ and pip_ work as
5151
expected with virtual environments. In other words, when a virtual
5252
environment is active, they install Python packages into the virtual
5353
environment without needing to be told to do so explicitly.
@@ -64,24 +64,25 @@ Creating virtual environments
6464
Python installation).
6565

6666
When a virtual environment is active, any options that change the
67-
installation path will be ignored from all distutils configuration files to
68-
prevent projects being inadvertently installed outside of the virtual
69-
environment.
67+
installation path will be ignored from all :mod:`distutils` configuration
68+
files to prevent projects being inadvertently installed outside of the
69+
virtual environment.
7070

7171
When working in a command shell, users can make a virtual environment active
7272
by running an ``activate`` script in the virtual environment's executables
73-
directory (the precise filename is shell-dependent), which prepends the
74-
virtual environment's directory for executables to the ``PATH`` environment
75-
variable for the running shell. There should be no need in other
76-
circumstances to activate a virtual environment—scripts installed into
77-
virtual environments have a "shebang" line which points to the virtual
78-
environment's Python interpreter. This means that the script will run with
79-
that interpreter regardless of the value of ``PATH``. On Windows, "shebang"
80-
line processing is supported if you have the Python Launcher for Windows
81-
installed (this was added to Python in 3.3 - see :pep:`397` for more
82-
details). Thus, double-clicking an installed script in a Windows Explorer
83-
window should run the script with the correct interpreter without there
84-
needing to be any reference to its virtual environment in ``PATH``.
73+
directory (the precise filename and command to use the file is
74+
shell-dependent), which prepends the virtual environment's directory for
75+
executables to the ``PATH`` environment variable for the running shell. There
76+
should be no need in other circumstances to activate a virtual
77+
environment; scripts installed into virtual environments have a "shebang"
78+
line which points to the virtual environment's Python interpreter. This means
79+
that the script will run with that interpreter regardless of the value of
80+
``PATH``. On Windows, "shebang" line processing is supported if you have the
81+
Python Launcher for Windows installed (this was added to Python in 3.3 - see
82+
:pep:`397` for more details). Thus, double-clicking an installed script in a
83+
Windows Explorer window should run the script with the correct interpreter
84+
without there needing to be any reference to its virtual environment in
85+
``PATH``.
8586

8687

8788
.. _venv-api:
@@ -135,20 +136,20 @@ creation according to their needs, the :class:`EnvBuilder` class.
135136
Added the ``upgrade_deps`` parameter
136137

137138
Creators of third-party virtual environment tools will be free to use the
138-
provided ``EnvBuilder`` class as a base class.
139+
provided :class:`EnvBuilder` class as a base class.
139140

140141
The returned env-builder is an object which has a method, ``create``:
141142

142143
.. method:: create(env_dir)
143144

144-
This method takes as required argument the path (absolute or relative to
145-
the current directory) of the target directory which is to contain the
145+
Create a virtual environment by specifying the target directory
146+
(absolute or relative to the current directory) which is to contain the
146147
virtual environment. The ``create`` method will either create the
147148
environment in the specified directory, or raise an appropriate
148149
exception.
149150

150-
The ``create`` method of the ``EnvBuilder`` class illustrates the hooks
151-
available for subclass customization::
151+
The ``create`` method of the :class:`EnvBuilder` class illustrates the
152+
hooks available for subclass customization::
152153

153154
def create(self, env_dir):
154155
"""
@@ -476,3 +477,7 @@ subclass which installs setuptools and pip into a created virtual environment::
476477

477478
This script is also available for download `online
478479
<https://gist.github.com/vsajip/4673395>`_.
480+
481+
482+
.. _setuptools: https://pypi.org/project/setuptools/
483+
.. _pip: https://pypi.org/project/pip/

0 commit comments

Comments
 (0)