Hi, Two years ago, PEP 632 "Deprecate distutils module" was accepted: the distutils package was deprecated in Python 3.10 and scheduled for removal in Python 3.12. Questions.
* Is the Python ecosystem ready for the distutils removal? How many projects are expected to be broken by this removal? * Is setuptools a drop-in replacement of distutils for most cases? Are there tools and documentation explaining how to replace distutils with setuptools? * Is there a tool to migrate from setup.py (distutils) to pyproject.toml (setuptools)? The dephell project can convert a setup.py script to pyproject.toml using poetry as the build system. * Can we simply suggest installing setuptools to users who still use "import distutils"? setuptools now provides the a "distutils" package. * Should we keep distutils in Python stdlib a few more Python releases if the removal causes too many practical issues? A code search in top 5000 PyPI projects (at 2022-01-26) using the regex '(import|from) distutils' matchs 5,567 lines in 1,229 projects. Some statistics: * 851 projects (1,372 lines) import distutils in setup.py * 233 projects (700 lines) use distutils.version * 92 projects (205 lines) use distutils.util * 1,018 lines are type annotations (.pyi files) I failed to group the remaining 2,272 lines. Converting 851 projects from setup.py with distutils to pyproject.toml is going to take a few months if not years. Python 3.12 will likely be released in October 2023 (in year and a half). Since setuptools 60 (December 2021), setuptools installs a distutils-precedence.pth file to override the stdlib module with its local distutils copy by default. The SETUPTOOLS_USE_DISTUTILS=stdlib environment variable can be used to explicitly request the stdlib flavor. If I understood correct, distutils is now maintained in setuptools, rather than in the Python stdlib. Python "make install" installs an up to date setuptools and so indirectly its distutils-precedence.pth file which makes the distutils local copy of setuptools available. But many Linux distributions splits setuptools and pip from the "python" package. Right now, Python still uses distutils internally for multiple use cases. I propose to start with renaming the distutils package to _distutils in the stdlib: * https://github.com/python/cpython/issues/92584 * https://github.com/python/cpython/pull/92585 Right now, the change is blocked by pip which still imports distutils (even if it prefers sysconfig in practice on Python 3.10 and newer). I reported the issue to pip, it should be easy to fix. Once Python will no longer depend on _distutils, it will be possible to fully remove it. By the way, Fedora 35 now longer provides automatically setuptools when building a Python package. A dependency to setuptools must now be explicit, since they are projects which don't use setuptools nor distutils, but other build systems. https://fedoraproject.org/wiki/Changes/Reduce_dependencies_on_python3-setuptools Victor -- Night gathers, and now my watch begins. It shall not end until my death. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/XFZJ43VSIWCYNQ5ZYT64XF7PMH4YDUWC/ Code of Conduct: http://python.org/psf/codeofconduct/