@@ -5,7 +5,7 @@ Author: Stan Ulbrych <stanulbrych@gmail.com>,
55Discussions-To: https://discuss.python.org/t/lets-make-zlib-required-rather-than-optional-to-build-cpython/23062
66Status: Draft
77Type: Standards Track
8- Created: 20 -Feb-2025
8+ Created: 24 -Feb-2025
99Python-Version: 3.14
1010Post-History: `23-Jan-2023 <https://discuss.python.org/t/23062 >`__
1111
@@ -15,31 +15,29 @@ Abstract
1515Building CPython on systems without the `zlib <https://zlib.net >`_ compression library, except WASI,
1616is no longer supported.
1717
18- The `` zlib ` ` module is made a required part of the standard library,
18+ The :mod: ` zlib ` module is made a required part of the standard library,
1919except on WASI.
2020
21- Builds without `` zlib `` will still be possible, but formally unsupported.
21+ Builds without zlib will still be possible, but formally unsupported.
2222
2323
2424Motivation
2525==========
2626
27- The `` zlib `` library, which powers the `` zlib ` ` Python module,
27+ The zlib library, which powers the :mod: ` ! zlib ` Python module,
2828is available on virtually all systems.
2929
30- Many wheels on PyPI, including the `pip `_ installer, require ``zlib ``.
31- Users of *pip * would consider CPython without ``zlib `` to be broken,
32- but mostly don't notice because all major builds of CPython include ``zlib ``.
33-
34- .. _pip : https://pypi.org/project/pip/
30+ Many wheels on PyPI, including the :pypi: `pip ` installer, require zlib.
31+ Users of pip would consider CPython without zlib to be broken,
32+ but mostly don't notice because all major builds of CPython include zlib.
3533
3634CPython developers don't really notice either. It turns out that at the time
37- of this writing, at least one CPython test fails without `` zlib `` (the “ skip”
35+ of writing, at least one CPython test fails without zlib (the " skip"
3836decorator in ``test_peg_generator.test_c_parser `` is applied too late),
3937but our CI didn't catch this.
4038
4139This PEP treats this as an issue in documentation and messaging.
42- In practice, we already don't support building CPython without `` zlib `` ; we
40+ In practice, we already don't support building CPython without zlib; we
4341should just say so.
4442
4543
@@ -52,52 +50,52 @@ Therefore, we don't *remove* support for zlib-less systems; we mark them
5250unsupported and invite affected users to do their own testing, or to share
5351use cases that can make us reconsider this decision.
5452
55- `` zlib `` is not yet used by default on the WASI platform -- mostly because
53+ zlib is not yet used by default on the WASI platform -- mostly because
5654adding it hasn't yet been a priority there. (Note that `Pyodide `_, the main
57- “ real-world” CPython distribution for WASI, does include `` zlib `` .)
55+ " real-world" CPython distribution for WASI, does include zlib.)
5856We take this as an opportunity to continue testing a platform without
59- `` zlib `` , so that we don't unintentionally break unsupported builds yet.
57+ zlib, so that we don't unintentionally break unsupported builds yet.
6058
6159.. _Pyodide : https://pyodide.org
6260
6361
6462Specification
6563=============
6664
67- In standard library modules that use `` zlib `` for optional functionality,
65+ In standard library modules that use zlib for optional functionality,
6866that functionality will raise ``ImportError `` when used.
6967Code to generate more “friendly” error messages, or to pre-check whether
70- `` zlib `` is available, will be removed.
71- All non-`` zlib ``-related functionality will still be usable if `` zlib `` is
68+ zlib is available, will be removed.
69+ All functionality unrelated to zlib will still be usable if zlib is
7270missing.
7371
7472This affects the following modules, and more that depend on these
7573transitively:
7674
77- * `` shutil ` ` (``gztar `` and ``zip `` archive formats)
78- * `` tarfile ``, `` zipfile ``, `` zipimport ``, `` zipapp ` ` (archive compression)
79- * `` codecs ` ` (``zlib_codec ``)
75+ * :mod: ` shutil ` (``gztar `` and ``zip `` archive formats)
76+ * :mod: ` tarfile `, :mod: ` zipfile `, :mod: ` zipimport `, :mod: ` zipapp ` (archive compression)
77+ * :mod: ` codecs ` (``zlib_codec ``)
8078
8179``shutil.get_archive_formats() `` will always include ``zip `` and ``gztar ``
82- as registered formats, even if they are unusable due to missing `` zlib `` .
80+ as registered formats, even if they are unusable due to missing zlib.
8381
84- The ``configure `` script will issue a warning when `` zlib `` is not found on
82+ The ``configure `` script will issue a warning when zlib is not found on
8583platforms other than WASI.
8684
8785``test_zlib `` will fail on platforms other than WASI.
8886All other tests will continue to be skipped -- that is, uses of
8987``@test.support.requires_zlib `` will be kept in place -- for the benefit
9088of WASI, unsupported builds, and any possible reverts.
9189
92- PEP 11 will be adjusted to mark "Systems without zlib, except WASI" as
90+ :pep: ` 11 ` will be adjusted to mark "Systems without zlib, except WASI" as
9391unsupported.
9492
9593
9694Backwards Compatibility
9795=======================
9896
9997In practice, nothing major changes, except in error cases -- for example,
100- attempts to use tar compression withoutt `` zlib `` available will raise
98+ attempts to use tar compression without zlib available will raise
10199``ImportError `` and not ``CompressionError ``.
102100
103101
@@ -110,7 +108,7 @@ None known.
110108How to Teach This
111109=================
112110
113- We don't expect that any instructions will need to change, as `` zlib `` is
111+ We don't expect that any instructions will need to change, as zlib is
114112already available in all relevant contexts.
115113
116114
@@ -123,8 +121,8 @@ https://github.com/python/cpython/pull/130297
123121Future work
124122===========
125123
126- In the future, if no use cases for `` zlib `` -less builds are found,
127- `` zlib `` may be made fully required.
124+ In the future, if no use cases for zlib-less builds are found,
125+ zlib may be made fully required.
128126The main changes needed for that would be making the ``configure `` script
129127raise a hard error, and removing ``@test.support.requires_zlib ``.
130128
0 commit comments