You need zlib to install pip
, as both the wheel and sdist are compressed. The problem is not 300 extra lines of code. It’s that practically, for most users, CPython without zlib
is broken.
But,
- zlib-less builds of CPython might still be useful in some special cases.
- Requiring zlib for WASI is not (and should not be) a priority. I haven’t looked at Android and iOS; this discussion might predate their support.
Let’s make that official. I propose to change our messaging, not (much) code.
Here’s a concrete proposal. Where I say WASI, Android/iOS (or any other platform) can be added if needed.
The 3.14 What’s New should say:
zlib
is now officially required to build CPython.
It is still technically possible to build CPython without it for special needs, like bootstrapping. Such builds are not supported, but we can accept pull requests to keep them working.
As an exception, zlib
is not required on WASI.
Lib/test/test_zlib.py
should add the following comment, and a zlib
-less build should fail with an error message that points to it. This serves as a deprecation warning. (On WASI the tests should instead continue to be skipped.)
Building CPython without zlib
is not supported.
Anyone who wants build CPython this way should be prepared to patch it, but the core team may help getting those patches to the main
branch (as that’s the place where multiple third parties can cooperate).
For tests to pass without zlib
, this file needs to be removed.
Existing tests skips (e.g. @requires_zlib()
) stay in (except in test_zlib.py
itself, as above).
binascii
’s reimplementation of crc32 is removed; corresponding tests are skipped.
Code that only generates nice error messages in zlib
-less builds is removed. Corresponding tests are adjusted.
PEP 11 gets a new entry:
- Name: Systems without
zlib
, except WASI
- Unsupported in: Python 3.14
- Code removed in: Unknown (see
Lib/test/test_zlib.py
for details)
configure
is changed to produce a warning on systems without zlib
, except WASI.
Note that the WASI exception means that we’ll still test some zlib
-less build. That’s a good thing.
Getting zlib there is the opposite of a blocker issue: I’d prefer that to happen well after this change.