I think we have to differentiate a bit more:
-
One aspect is building CPython from source without zlib
-
Another aspect is running CPython and the stdlib in particular with a working zlib
module
-
Yet another is whether or not to accept patches for zlib-less installations of CPython
The PEP currently conflates these two, e.g. pip
doesn’t work without zlib
module (that’s the second aspect). Building CPython does work without zlib
, but some tests fail (that’s the first aspect).
Steve brought up the third aspect. The PEP hints into this direction as well (“Code to generate more “friendly” error messages, or to pre-check whether zlib
is available, will be removed.”).
IMO, we should treat zlib
just like we do all other similar external libs, e.g. ctypes
: CPython should continue to build without them, some tests may fail without them and some stdlib modules will not work without them (and should issue an appropriate error message).
The few places where the stdlib includes error messages related to this are really no maintenance burden, so I don’t see a need for dropping them. The same goes for patches providing work-arounds or additional errors/warnings for the situation where no zlib module is available.
As for not actively fully supporting a CPython without working zlib
module, I think that’s something we can document. The PEP could then be turned into a document describing which aspects of a CPython will fail without a working zlib
, so that people are aware of the implications.
Making an exception for WASI doesn’t strike me as necessary. It’s not a very common platform to run CPython on at the moment (this may change, of course, going forward). With the above change in emphasis, it would also not be needed. We could simply make a WASI an example of where we do have a CPython build without zlib
.
All that said, I’d also like to bring up another point:
Why don’t we simply vendor in zlib
and use it on platforms where configure does not find a system zlib
? We already do this on Windows.
The zlib
code base is a mere 5MB and the license is compatible with the PSF License.
With zlib
being widely used in the Python ecosystem, this would certainly be a viable choice.