-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-139707: Add docs for optional modules #140171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d89a92d
3cff681
f8f2161
c8f3521
b9de785
9f2c9e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This is an :term:`optional module`. | ||
If it is 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`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +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. zlib 1.2.2.1 is the minium | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not keeping the homepage link? |
||
supported version. | ||
allow compression and decompression, using the zlib library. | ||
|
||
.. 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; | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,10 +4,13 @@ Configure Python | |||||||||
|
||||||||||
.. highlight:: sh | ||||||||||
|
||||||||||
|
||||||||||
.. _build-requirements: | ||||||||||
|
||||||||||
Build Requirements | ||||||||||
================== | ||||||||||
|
||||||||||
Features and minimum versions required to build CPython: | ||||||||||
To build CPython, you will need: | ||||||||||
|
||||||||||
* A `C11 <https://en.cppreference.com/w/c/11>`_ compiler. `Optional C11 | ||||||||||
features | ||||||||||
|
@@ -22,83 +25,135 @@ Features and minimum versions required to build CPython: | |||||||||
|
||||||||||
* Support for threads. | ||||||||||
|
||||||||||
To build optional modules: | ||||||||||
|
||||||||||
* `libbz2 <https://sourceware.org/bzip2/>`_ for the :mod:`bz2` module. | ||||||||||
|
||||||||||
* `libb2 <https://github.com/BLAKE2/libb2>`_ (:ref:`BLAKE2 <hashlib-blake2>`) | ||||||||||
for the :mod:`hashlib` module. | ||||||||||
|
||||||||||
* `libffi <https://sourceware.org/libffi/>`_ 3.3.0 is the recommended | ||||||||||
minimum version for the :mod:`ctypes` module. | ||||||||||
|
||||||||||
* ``liblzma`` for the :mod:`lzma` module. | ||||||||||
|
||||||||||
* `libmpdec <https://www.bytereef.org/mpdecimal/doc/libmpdec/>`_ 2.5.0 | ||||||||||
for the :mod:`decimal` module. | ||||||||||
|
||||||||||
* ``libncurses`` or ``libncursesw`` for the :mod:`curses` module. | ||||||||||
|
||||||||||
* ``libpanel`` or ``libpanelw`` for the :mod:`curses.panel` module. | ||||||||||
|
||||||||||
* `libreadline <https://tiswww.case.edu/php/chet/readline/rltop.html>`_ or | ||||||||||
`libedit <https://www.thrysoee.dk/editline/>`_ | ||||||||||
for the :mod:`readline` module. | ||||||||||
|
||||||||||
* `libuuid <https://linux.die.net/man/3/libuuid>`_ for the :mod:`uuid` module. | ||||||||||
|
||||||||||
* `OpenSSL <https://www.openssl.org/>`_ 1.1.1 is the minimum version and | ||||||||||
OpenSSL 3.0.18 is the recommended minimum version for the | ||||||||||
:mod:`ssl` and :mod:`hashlib` extension modules. | ||||||||||
.. versionchanged:: 3.5 | ||||||||||
On Windows, Visual Studio 2015 or later is now required. | ||||||||||
|
||||||||||
* `SQLite <https://sqlite.org/>`_ 3.15.2 for the :mod:`sqlite3` extension module. | ||||||||||
.. versionchanged:: 3.6 | ||||||||||
Selected C99 features, like ``<stdint.h>`` and ``static inline`` functions, | ||||||||||
are now required. | ||||||||||
|
||||||||||
* `Tcl/Tk <https://www.tcl-lang.org/>`_ 8.5.12 for the :mod:`tkinter` module. | ||||||||||
.. versionchanged:: 3.7 | ||||||||||
Thread support is now required. | ||||||||||
|
||||||||||
* `zlib <https://www.zlib.net>`_ 1.2.2.1 is the minimum version for the | ||||||||||
:mod:`zlib` module. | ||||||||||
.. versionchanged:: 3.11 | ||||||||||
C11 compiler, IEEE 754 and NaN support are now required. | ||||||||||
On Windows, Visual Studio 2017 or later is required. | ||||||||||
|
||||||||||
* `zstd <https://facebook.github.io/zstd/>`_ 1.4.5 is the minimum version for | ||||||||||
the :mod:`compression.zstd` module. | ||||||||||
See also :pep:`7` "Style Guide for C Code" and :pep:`11` "CPython platform | ||||||||||
support". | ||||||||||
|
||||||||||
For a full list of dependencies required to build all modules and how to install | ||||||||||
them, see the | ||||||||||
`devguide <https://devguide.python.org/getting-started/setup-building/#install-dependencies>`_. | ||||||||||
|
||||||||||
* Autoconf 2.72 and aclocal 1.16.5 are required to regenerate the | ||||||||||
:file:`configure` script. | ||||||||||
.. _optional-module-requirements: | ||||||||||
|
||||||||||
Requirements for Optional Modules | ||||||||||
--------------------------------- | ||||||||||
Comment on lines
+48
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use sentence case for headers: https://devguide.python.org/documentation/style-guide/#capitalization
Suggested change
|
||||||||||
|
||||||||||
To build :term:`optional modules <optional module>` of the standard library, | ||||||||||
you will need several third-party libraries installed for development | ||||||||||
(for example, header files must be available). | ||||||||||
|
||||||||||
Missing requirements are generally given in ``configure`` output. | ||||||||||
Missing optional modules are listed near the end of ``make`` output, | ||||||||||
sometimes using an internal name such as ``_ctypes`` for the :mod:`ctypes` | ||||||||||
module. | ||||||||||
|
||||||||||
If you distribute a CPython interpreter without optional modules, | ||||||||||
it's best practice to advise users, who generally expect that | ||||||||||
standard library modules are available. | ||||||||||
|
||||||||||
Dependencies to build optional modules are: | ||||||||||
|
||||||||||
.. list-table:: | ||||||||||
:header-rows: 1 | ||||||||||
:align: left | ||||||||||
|
||||||||||
* - Dependency | ||||||||||
- Minimum version | ||||||||||
- Python module | ||||||||||
* - `libbz2 <https://sourceware.org/bzip2/>`_ | ||||||||||
- | ||||||||||
- :mod:`bz2` | ||||||||||
* - `libffi <https://sourceware.org/libffi/>`_ | ||||||||||
- 3.3.0 recommended | ||||||||||
- :mod:`ctypes` | ||||||||||
* - `liblzma <https://tukaani.org/xz/>`_ | ||||||||||
- | ||||||||||
- :mod:`lzma` | ||||||||||
* - `libmpdec <https://www.bytereef.org/mpdecimal/doc/libmpdec/>`_ | ||||||||||
- 2.5.0 | ||||||||||
- :mod:`decimal` [1]_ | ||||||||||
* - `libreadline <https://tiswww.case.edu/php/chet/readline/rltop.html>`_ or | ||||||||||
`libedit <https://www.thrysoee.dk/editline/>`_ [2]_ | ||||||||||
- | ||||||||||
- :mod:`readline` | ||||||||||
* - `libuuid <https://linux.die.net/man/3/libuuid>`_ | ||||||||||
- | ||||||||||
- ``_uuid`` [3]_ | ||||||||||
* - `ncurses <https://gnu.org/software/ncurses/ncurses.html>`_ [4]_ | ||||||||||
- | ||||||||||
- :mod:`curses` | ||||||||||
* - `OpenSSL <https://openssl-library.org/>`_ | ||||||||||
- | 3.0.18 recommended | ||||||||||
| (1.1.1 minimum) | ||||||||||
- :mod:`ssl`, :mod:`hashlib` [5]_ | ||||||||||
* - `SQLite <https://sqlite.org/>`_ | ||||||||||
- 3.15.2 | ||||||||||
- :mod:`sqlite3` | ||||||||||
* - `Tcl/Tk <https://www.tcl-lang.org/>`_ | ||||||||||
- 8.5.12 | ||||||||||
- :mod:`tkinter` | ||||||||||
* - `zlib <https://www.zlib.net>`_ | ||||||||||
- 1.2.2.1 | ||||||||||
- :mod:`zlib`, :mod:`gzip`, :mod:`ensurepip` | ||||||||||
* - `zstd <https://facebook.github.io/zstd/>`_ | ||||||||||
- 1.4.5 | ||||||||||
- :mod:`compression.zstd` | ||||||||||
|
||||||||||
.. [1] If *libmpdec* is not available, CPython will use a bundled copy. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That changed in Python 3.15: https://docs.python.org/dev/whatsnew/3.15.html#build-changes |
||||||||||
This is deprecated; see :option:`--with-system-libmpdec` for details. | ||||||||||
|
||||||||||
.. when the bundled libmpdec is removed, we should instead note that | ||||||||||
:mod:`decimal` will fall back to a pure-Python implementation. | ||||||||||
|
||||||||||
.. [2] See :option:`--with-readline` for choosing the backend for the | ||||||||||
:mod:`readline` module. | ||||||||||
.. [3] The :mod:`uuid` module uses ``_uuid`` to generate "safe" UUIDs. | ||||||||||
See the module documentation for details. | ||||||||||
.. [4] The :mod:`curses` module requires the ``libncurses`` or ``libncursesw`` | ||||||||||
library. | ||||||||||
The :mod:`curses.panel` module additionally requires the ``libpanel`` or | ||||||||||
``libpanelw`` library. | ||||||||||
.. [5] If OpenSSL is not available, the :mod:`hashlib` module will use | ||||||||||
bundled implementations of several hash functions. | ||||||||||
See :option:`--with-builtin-hashlib-hashes` for *forcing* usage of OpenSSL. | ||||||||||
|
||||||||||
.. seealso:: | ||||||||||
|
||||||||||
* The `devguide <https://devguide.python.org/getting-started/setup-building/#install-dependencies>`_ | ||||||||||
includes a full list of dependencies required to build all modules and | ||||||||||
instructions on how to install them on common platforms. | ||||||||||
* :option:`--with-system-expat` allows building with an external | ||||||||||
`libexpat <https://libexpat.github.io/>`_ library. | ||||||||||
* :ref:`configure-options-for-dependencies` | ||||||||||
|
||||||||||
.. versionchanged:: 3.1 | ||||||||||
Tcl/Tk version 8.3.1 is now required. | ||||||||||
Tcl/Tk version 8.3.1 is now required for :mod:`tkinter`. | ||||||||||
|
||||||||||
.. versionchanged:: 3.5 | ||||||||||
On Windows, Visual Studio 2015 or later is now required. | ||||||||||
Tcl/Tk version 8.4 is now required. | ||||||||||
|
||||||||||
.. versionchanged:: 3.6 | ||||||||||
Selected C99 features are now required, like ``<stdint.h>`` and ``static | ||||||||||
inline`` functions. | ||||||||||
Tcl/Tk version 8.4 is now required for :mod:`tkinter`. | ||||||||||
|
||||||||||
.. versionchanged:: 3.7 | ||||||||||
Thread support and OpenSSL 1.0.2 are now required. | ||||||||||
OpenSSL 1.0.2 are now required for :mod:`hashlib`. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
.. versionchanged:: 3.10 | ||||||||||
OpenSSL 1.1.1 is now required. | ||||||||||
Require SQLite 3.7.15. | ||||||||||
OpenSSL 1.1.1 is now required for :mod:`hashlib`. | ||||||||||
SQLite 3.7.15 is now required for :mod:`sqlite3`. | ||||||||||
|
||||||||||
.. versionchanged:: 3.11 | ||||||||||
C11 compiler, IEEE 754 and NaN support are now required. | ||||||||||
On Windows, Visual Studio 2017 or later is required. | ||||||||||
Tcl/Tk version 8.5.12 is now required for the :mod:`tkinter` module. | ||||||||||
Tcl/Tk version 8.5.12 is now required for :mod:`tkinter`. | ||||||||||
|
||||||||||
.. versionchanged:: 3.13 | ||||||||||
Autoconf 2.71, aclocal 1.16.5 and SQLite 3.15.2 are now required. | ||||||||||
|
||||||||||
.. versionchanged:: 3.14 | ||||||||||
Autoconf 2.72 is now required. | ||||||||||
|
||||||||||
See also :pep:`7` "Style Guide for C Code" and :pep:`11` "CPython platform | ||||||||||
support". | ||||||||||
SQLite 3.15.2 is now required for :mod:`sqlite3`. | ||||||||||
|
||||||||||
|
||||||||||
Generated files | ||||||||||
|
@@ -127,8 +182,19 @@ The container is optional, the following command can be run locally:: | |||||||||
|
||||||||||
autoreconf -ivf -Werror | ||||||||||
|
||||||||||
The generated files can change depending on the exact ``autoconf-archive``, | ||||||||||
``aclocal`` and ``pkg-config`` versions. | ||||||||||
The generated files can change depending on the exact versions of the | ||||||||||
tools used. | ||||||||||
The container that CPython uses has | ||||||||||
`Autoconf <https://gnu.org/software/autoconf>`_ 2.72, | ||||||||||
``aclocal`` from `Automake <https://www.gnu.org/software/automake>`_ 1.16.5, | ||||||||||
and `pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config/>`_ 1.8.1. | ||||||||||
|
||||||||||
.. versionchanged:: 3.13 | ||||||||||
Autoconf 2.71 and aclocal 1.16.5 and are now used to regenerate | ||||||||||
:file:`configure`. | ||||||||||
|
||||||||||
.. versionchanged:: 3.14 | ||||||||||
Autoconf 2.72 is now used to regenerate :file:`configure`. | ||||||||||
|
||||||||||
|
||||||||||
.. _configure-options: | ||||||||||
|
@@ -409,6 +475,8 @@ Linker options | |||||||||
Name for machine-dependent library files. | ||||||||||
|
||||||||||
|
||||||||||
.. _configure-options-for-dependencies: | ||||||||||
|
||||||||||
Options for third-party dependencies | ||||||||||
------------------------------------ | ||||||||||
|
||||||||||
|
@@ -431,12 +499,6 @@ Options for third-party dependencies | |||||||||
|
||||||||||
C compiler and linker flags for ``gdbm``. | ||||||||||
|
||||||||||
.. option:: LIBB2_CFLAGS | ||||||||||
.. option:: LIBB2_LIBS | ||||||||||
|
||||||||||
C compiler and linker flags for ``libb2`` (:ref:`BLAKE2 <hashlib-blake2>`), | ||||||||||
used by :mod:`hashlib` module, overriding ``pkg-config``. | ||||||||||
|
||||||||||
.. option:: LIBEDIT_CFLAGS | ||||||||||
.. option:: LIBEDIT_LIBS | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two suggestions:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to link the CPython term too?