[3.14] gh-139707: Add docs for optional modules (GH-140171) (GH-141204)

(cherry picked from commit d2ce6d708a)

Co-authored-by: Petr Viktorin <encukou@gmail.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>
This commit is contained in:
Stan Ulbrych 2025-11-10 14:20:00 +00:00 committed by GitHub
parent 44a3d6c69b
commit c12a0bef40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 221 additions and 86 deletions

View file

@ -25,6 +25,8 @@ The :mod:`bz2` module contains:
* The :func:`compress` and :func:`decompress` functions for one-shot
(de)compression.
.. include:: ../includes/optional-module.rst
(De)compression of files
------------------------

View file

@ -33,6 +33,8 @@ The :mod:`!compression.zstd` module contains:
* The :class:`CompressionParameter`, :class:`DecompressionParameter`, and
:class:`Strategy` classes for setting advanced (de)compression parameters.
.. include:: ../includes/optional-module.rst
Exceptions
----------

View file

@ -14,6 +14,8 @@
data types, and allows calling functions in DLLs or shared libraries. It can be
used to wrap these libraries in pure Python.
.. include:: ../includes/optional-module.rst
.. _ctypes-ctypes-tutorial:

View file

@ -23,6 +23,8 @@ Linux and the BSD variants of Unix.
.. include:: ../includes/wasm-mobile-notavail.rst
.. include:: ../includes/optional-module.rst
.. note::
Whenever the documentation mentions a *character* it can be specified

View file

@ -30,6 +30,8 @@ when creating a virtual environment) or after explicitly uninstalling
needed to bootstrap ``pip`` are included as internal parts of the
package.
.. include:: ../includes/optional-module.rst
.. seealso::
:ref:`installing-index`

View file

@ -11,6 +11,8 @@
This module provides a simple interface to compress and decompress files just
like the GNU programs :program:`gzip` and :program:`gunzip` would.
.. include:: ../includes/optional-module.rst
The data compression is provided by the :mod:`zlib` module.
The :mod:`gzip` module provides the :class:`GzipFile` class, as well as the

View file

@ -37,6 +37,10 @@ IDLE has the following features:
* configuration, browsers, and other dialogs
The IDLE application is implemented in the :mod:`idlelib` package.
.. include:: ../includes/optional-module.rst
Menus
-----

View file

@ -23,6 +23,8 @@ module. Note that :class:`LZMAFile` and :class:`bz2.BZ2File` are *not*
thread-safe, so if you need to use a single :class:`LZMAFile` instance
from multiple threads, it is necessary to protect it with a lock.
.. include:: ../includes/optional-module.rst
.. exception:: LZMAError

View file

@ -26,6 +26,8 @@ Readline library in general.
.. include:: ../includes/wasm-mobile-notavail.rst
.. include:: ../includes/optional-module.rst
.. note::
The underlying Readline library API may be implemented by

View file

@ -31,7 +31,9 @@ PostgreSQL or Oracle.
The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an SQL interface
compliant with the DB-API 2.0 specification described by :pep:`249`, and
requires SQLite 3.15.2 or newer.
requires the third-party `SQLite <https://sqlite.org/>`_ library.
.. include:: ../includes/optional-module.rst
This document includes four main sections:

View file

@ -18,8 +18,9 @@
This module provides access to Transport Layer Security (often known as "Secure
Sockets Layer") encryption and peer authentication facilities for network
sockets, both client-side and server-side. This module uses the OpenSSL
library. It is available on all modern Unix systems, Windows, macOS, and
probably additional platforms, as long as OpenSSL is installed on that platform.
library.
.. include:: ../includes/optional-module.rst
.. note::

View file

@ -21,6 +21,14 @@ Some facts and figures:
* reads and writes :mod:`gzip`, :mod:`bz2`, :mod:`compression.zstd`, and
:mod:`lzma` compressed archives if the respective modules are available.
..
The following paragraph should be similar to ../includes/optional-module.rst
If any of these :term:`optional modules <optional module>` are missing from
your copy of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).
If you are the distributor, see :ref:`optional-module-requirements`.
* read/write support for the POSIX.1-1988 (ustar) format.
* read/write support for the GNU tar format including *longname* and *longlink*

View file

@ -36,6 +36,8 @@ details that are unchanged.
Most documentation you will find online still uses the old API and
can be woefully outdated.
.. include:: ../includes/optional-module.rst
.. seealso::
* `TkDocs <https://tkdocs.com/>`_

View file

@ -29,6 +29,8 @@ introduced in Logo <https://en.wikipedia.org/wiki/Turtle_
(robot)>`_, developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon
in 1967.
.. include:: ../includes/optional-module.rst
Get started
===========

View file

@ -23,6 +23,16 @@ decryption of encrypted files in ZIP archives, but it currently cannot
create an encrypted file. Decryption is extremely slow as it is
implemented in native Python rather than C.
..
The following paragraph should be similar to ../includes/optional-module.rst
Handling compressed archives requires :term:`optional modules <optional module>`
such as :mod:`zlib`, :mod:`bz2`, :mod:`lzma`, and :mod:`compression.zstd`.
If any of them are missing from your copy of CPython,
look for documentation from your distributor (that is,
whoever provided Python to you).
If you are the distributor, see :ref:`optional-module-requirements`.
The module defines the following items:
.. exception:: BadZipFile

View file

@ -8,11 +8,9 @@
--------------
For applications that require data compression, the functions in this module
allow compression and decompression, using the zlib library. The zlib library
has its own home page at https://www.zlib.net. There are known
incompatibilities between the Python module and versions of the zlib library
earlier than 1.1.3; 1.1.3 has a `security vulnerability <https://zlib.net/zlib_faq.html#faq33>`_, so we recommend using
1.1.4 or later.
allow compression and decompression, using the `zlib library <https://www.zlib.net>`_.
.. include:: ../includes/optional-module.rst
zlib's functions have many options and often need to be used in a particular
order. This documentation doesn't attempt to cover all of the permutations;