Skip to content

Commit 67a3631

Browse files
[3.12] docs: improve venv docs (GH-124540) (#124728)
- Move "versionchanged" notes that apply to the whole class to the end of the class docs - Remove or move notes next to the method list that apply to individual methods. - Mark up parameters using the appropriate syntax - Do not capitalize "boolean" - Shorten some text (cherry picked from commit c976d78)
1 parent b3360dc commit 67a3631

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

Doc/library/venv.rst

+24-27
Original file line numberDiff line numberDiff line change
@@ -167,29 +167,29 @@ creation according to their needs, the :class:`EnvBuilder` class.
167167
The :class:`EnvBuilder` class accepts the following keyword arguments on
168168
instantiation:
169169

170-
* ``system_site_packages`` -- a Boolean value indicating that the system Python
170+
* *system_site_packages* -- a boolean value indicating that the system Python
171171
site-packages should be available to the environment (defaults to ``False``).
172172

173-
* ``clear`` -- a Boolean value which, if true, will delete the contents of
173+
* *clear* -- a boolean value which, if true, will delete the contents of
174174
any existing target directory, before creating the environment.
175175

176-
* ``symlinks`` -- a Boolean value indicating whether to attempt to symlink the
176+
* *symlinks* -- a boolean value indicating whether to attempt to symlink the
177177
Python binary rather than copying.
178178

179-
* ``upgrade`` -- a Boolean value which, if true, will upgrade an existing
179+
* *upgrade* -- a boolean value which, if true, will upgrade an existing
180180
environment with the running Python - for use when that Python has been
181181
upgraded in-place (defaults to ``False``).
182182

183-
* ``with_pip`` -- a Boolean value which, if true, ensures pip is
183+
* *with_pip* -- a boolean value which, if true, ensures pip is
184184
installed in the virtual environment. This uses :mod:`ensurepip` with
185185
the ``--default-pip`` option.
186186

187-
* ``prompt`` -- a String to be used after virtual environment is activated
187+
* *prompt* -- a string to be used after virtual environment is activated
188188
(defaults to ``None`` which means directory name of the environment would
189189
be used). If the special string ``"."`` is provided, the basename of the
190190
current directory is used as the prompt.
191191

192-
* ``upgrade_deps`` -- Update the base venv modules to the latest on PyPI
192+
* *upgrade_deps* -- Update the base venv modules to the latest on PyPI
193193

194194
.. versionchanged:: 3.4
195195
Added the ``with_pip`` parameter
@@ -200,10 +200,7 @@ creation according to their needs, the :class:`EnvBuilder` class.
200200
.. versionchanged:: 3.9
201201
Added the ``upgrade_deps`` parameter
202202

203-
Creators of third-party virtual environment tools will be free to use the
204-
provided :class:`EnvBuilder` class as a base class.
205-
206-
The returned env-builder is an object which has a method, ``create``:
203+
:class:`EnvBuilder` may be used as a base class.
207204

208205
.. method:: create(env_dir)
209206

@@ -303,37 +300,27 @@ creation according to their needs, the :class:`EnvBuilder` class.
303300

304301
.. method:: upgrade_dependencies(context)
305302

306-
Upgrades the core venv dependency packages (currently ``pip``)
303+
Upgrades the core venv dependency packages (currently :pypi:`pip`)
307304
in the environment. This is done by shelling out to the
308305
``pip`` executable in the environment.
309306

310307
.. versionadded:: 3.9
311308
.. versionchanged:: 3.12
312309

313-
``setuptools`` is no longer a core venv dependency.
310+
:pypi:`setuptools` is no longer a core venv dependency.
314311

315312
.. method:: post_setup(context)
316313

317314
A placeholder method which can be overridden in third party
318315
implementations to pre-install packages in the virtual environment or
319316
perform other post-creation steps.
320317

321-
.. versionchanged:: 3.7.2
322-
Windows now uses redirector scripts for ``python[w].exe`` instead of
323-
copying the actual binaries. In 3.7.2 only :meth:`setup_python` does
324-
nothing unless running from a build in the source tree.
325-
326-
.. versionchanged:: 3.7.3
327-
Windows copies the redirector scripts as part of :meth:`setup_python`
328-
instead of :meth:`setup_scripts`. This was not the case in 3.7.2.
329-
When using symlinks, the original executables will be linked.
330-
331-
In addition, :class:`EnvBuilder` provides this utility method that can be
332-
called from :meth:`setup_scripts` or :meth:`post_setup` in subclasses to
333-
assist in installing custom scripts into the virtual environment.
334-
335318
.. method:: install_scripts(context, path)
336319

320+
This method can be
321+
called from :meth:`setup_scripts` or :meth:`post_setup` in subclasses to
322+
assist in installing custom scripts into the virtual environment.
323+
337324
*path* is the path to a directory that should contain subdirectories
338325
"common", "posix", "nt", each containing scripts destined for the bin
339326
directory in the environment. The contents of "common" and the
@@ -358,6 +345,16 @@ creation according to their needs, the :class:`EnvBuilder` class.
358345
The directories are allowed to exist (for when an existing environment
359346
is being upgraded).
360347

348+
.. versionchanged:: 3.7.2
349+
Windows now uses redirector scripts for ``python[w].exe`` instead of
350+
copying the actual binaries. In 3.7.2 only :meth:`setup_python` does
351+
nothing unless running from a build in the source tree.
352+
353+
.. versionchanged:: 3.7.3
354+
Windows copies the redirector scripts as part of :meth:`setup_python`
355+
instead of :meth:`setup_scripts`. This was not the case in 3.7.2.
356+
When using symlinks, the original executables will be linked.
357+
361358
There is also a module-level convenience function:
362359

363360
.. function:: create(env_dir, system_site_packages=False, clear=False, \

0 commit comments

Comments
 (0)