Description
For the last few years, we've stopped updating distutils
to support new packaging interoperability standards, and have instead recommended that folks that want to rely on features in metadata 1.2+, or to generate wheel archives, switch to using setuptools
. This has allowed the packaging metadata support to evolve independently of the exact version of Python that folks are using to publish their packages, and it's worked well enough that I'm willing to call the approach a success.
However, it has left us with a maintainability issue, which is that we still have a distutils
API implementation shipping with CPython that we don't actually want people to be using, and the source of the problem isn't always obvious when folks using that implementation aren't getting the behaviour they expect or want.
pip
has long injected the setuptools
monkeypatches of distutils
before running setup.py
scripts, and the setuptools
folks are considering switching to providing their own setuptools
-maintained copy of distutils
rather than continuing to monkeypatch the standard library version at import time: pypa/setuptools#417
I think the cleanest way to resolve this will be to actively seek to switch distutils
over to the ensurepip
model of maintenance: add an ensuredistutils
module to the standard library that installs bundled versions of setuptools
and wheel
, just as ensurepip
installs a bundled copy of pip
.
Identified substeps:
- Agreement from at least me, @jaraco, and @dstufft that this is the direction we want to start moving
- Adopt distutils setuptools#417 (removes
setuptools
dependency on stdlibdistutils
) - Make the setuptools documentation self-contained (rather than being a delta on top of the distutils documentation). This will mean also covering the injected
distutils
API in thesetuptools
documentation. - Write a PEP for an
ensuredistutils
module targeting either Python 3.9 (feature freeze early 2020) or 3.10 (feature freeze early 2021) - As part of that PEP, consider whether or not we might want to use the opportunity to make the installation of distutils entirely opt-in (given that pip 10+ will automatically install setuptools+wheel when asked to build a distribution from source that doesn't specify a different build system, and that any projects relying on
pkg_resources
at runtime should be explicitly declaring a dependency onsetuptools
anyway) - Assuming the PEP is accepted, make the required changes to CPython and its documentation
- Assuming the PEP is accepted, update the triaging instructions in the CPython developer guide to advise that distutils bugs reports and enhancement requests should be closed as "third party", and the submitters redirected to the setuptools issue tracker.