Skip to content

Commit b73cb36

Browse files
encukouStanFromIrelandhugovkemmatypingterryjreedy
committed
[3.14] pythongh-139707: Add docs for optional modules (pythonGH-140171)
(cherry picked from commit d2ce6d7) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Emma Smith <emma@emmatyping.dev> Co-authored-by: Author: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 9f8ec95 commit b73cb36

20 files changed

+216
-81
lines changed

Doc/glossary.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,15 @@ Glossary
10251025
applied to all scopes, only those relying on a known set of local
10261026
and nonlocal variable names are restricted to optimized scopes.
10271027

1028+
optional module
1029+
An :term:`extension module` that is part of the :term:`standard library`,
1030+
but may be absent in some builds of :term:`CPython`,
1031+
usually due to missing third-party libraries or because the module
1032+
is not available for a given platform.
1033+
1034+
See :ref:`optional-module-requirements` for a list of optional modules
1035+
that require third-party libraries.
1036+
10281037
package
10291038
A Python :term:`module` which can contain submodules or recursively,
10301039
subpackages. Technically, a package is a Python module with a

Doc/includes/optional-module.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This is an :term:`optional module`.
2+
If it is missing from your copy of CPython,
3+
look for documentation from your distributor (that is,
4+
whoever provided Python to you).
5+
If you are the distributor, see :ref:`optional-module-requirements`.
6+
7+
.. Similar notes appear in the docs of the modules:
8+
- zipfile
9+
- tarfile

Doc/library/bz2.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ The :mod:`bz2` module contains:
2525
* The :func:`compress` and :func:`decompress` functions for one-shot
2626
(de)compression.
2727

28+
.. include:: ../includes/optional-module.rst
29+
2830

2931
(De)compression of files
3032
------------------------

Doc/library/compression.zstd.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ The :mod:`!compression.zstd` module contains:
3333
* The :class:`CompressionParameter`, :class:`DecompressionParameter`, and
3434
:class:`Strategy` classes for setting advanced (de)compression parameters.
3535

36+
.. include:: ../includes/optional-module.rst
37+
3638

3739
Exceptions
3840
----------

Doc/library/ctypes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
data types, and allows calling functions in DLLs or shared libraries. It can be
1515
used to wrap these libraries in pure Python.
1616

17+
.. include:: ../includes/optional-module.rst
18+
1719

1820
.. _ctypes-ctypes-tutorial:
1921

Doc/library/curses.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Linux and the BSD variants of Unix.
2323

2424
.. include:: ../includes/wasm-mobile-notavail.rst
2525

26+
.. include:: ../includes/optional-module.rst
27+
2628
.. note::
2729

2830
Whenever the documentation mentions a *character* it can be specified

Doc/library/ensurepip.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ when creating a virtual environment) or after explicitly uninstalling
3030
needed to bootstrap ``pip`` are included as internal parts of the
3131
package.
3232

33+
.. include:: ../includes/optional-module.rst
34+
3335
.. seealso::
3436

3537
:ref:`installing-index`

Doc/library/gzip.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
This module provides a simple interface to compress and decompress files just
1212
like the GNU programs :program:`gzip` and :program:`gunzip` would.
1313

14+
.. include:: ../includes/optional-module.rst
15+
1416
The data compression is provided by the :mod:`zlib` module.
1517

1618
The :mod:`gzip` module provides the :class:`GzipFile` class, as well as the

Doc/library/idle.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ IDLE has the following features:
3737

3838
* configuration, browsers, and other dialogs
3939

40+
The IDLE application is implemented in the :mod:`idlelib` package.
41+
42+
.. include:: ../includes/optional-module.rst
43+
4044
Menus
4145
-----
4246

Doc/library/lzma.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ module. Note that :class:`LZMAFile` and :class:`bz2.BZ2File` are *not*
2323
thread-safe, so if you need to use a single :class:`LZMAFile` instance
2424
from multiple threads, it is necessary to protect it with a lock.
2525

26+
.. include:: ../includes/optional-module.rst
27+
2628

2729
.. exception:: LZMAError
2830

0 commit comments

Comments
 (0)