Skip to content

Commit ea8eaa3

Browse files
Apply suggestions from Hugo
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent b954f78 commit ea8eaa3

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

peps/pep-0775.rst

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Author: Stan Ulbrych <stanulbrych@gmail.com>,
55
Discussions-To: https://discuss.python.org/t/lets-make-zlib-required-rather-than-optional-to-build-cpython/23062
66
Status: Draft
77
Type: Standards Track
8-
Created: 20-Feb-2025
8+
Created: 24-Feb-2025
99
Python-Version: 3.14
1010
Post-History: `23-Jan-2023 <https://discuss.python.org/t/23062>`__
1111

@@ -15,31 +15,29 @@ Abstract
1515
Building CPython on systems without the `zlib <https://zlib.net>`_ compression library, except WASI,
1616
is 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,
1919
except 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

2424
Motivation
2525
==========
2626

27-
The ``zlib`` library, which powers the ``zlib`` Python module,
27+
The zlib library, which powers the :mod:`!zlib` Python module,
2828
is 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

3634
CPython 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"
3836
decorator in ``test_peg_generator.test_c_parser`` is applied too late),
3937
but our CI didn't catch this.
4038

4139
This 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
4341
should just say so.
4442

4543

@@ -52,52 +50,52 @@ Therefore, we don't *remove* support for zlib-less systems; we mark them
5250
unsupported and invite affected users to do their own testing, or to share
5351
use 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
5654
adding 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.)
5856
We 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

6462
Specification
6563
=============
6664

67-
In standard library modules that use ``zlib`` for optional functionality,
65+
In standard library modules that use zlib for optional functionality,
6866
that functionality will raise ``ImportError`` when used.
6967
Code 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
7270
missing.
7371

7472
This affects the following modules, and more that depend on these
7573
transitively:
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
8583
platforms other than WASI.
8684

8785
``test_zlib`` will fail on platforms other than WASI.
8886
All other tests will continue to be skipped -- that is, uses of
8987
``@test.support.requires_zlib`` will be kept in place -- for the benefit
9088
of 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
9391
unsupported.
9492

9593

9694
Backwards Compatibility
9795
=======================
9896

9997
In 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.
110108
How 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
114112
already available in all relevant contexts.
115113

116114

@@ -123,8 +121,8 @@ https://github.com/python/cpython/pull/130297
123121
Future 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.
128126
The main changes needed for that would be making the ``configure`` script
129127
raise a hard error, and removing ``@test.support.requires_zlib``.
130128

0 commit comments

Comments
 (0)