setuptools has been the canonical implementation of USE_PYTHON=distutils, namely the direct execution of ${PYSETUP} which is almost always setup.py. While this method continues to work for the most part, the setuptools maintainers have long considered the command line interface fragile and officially deprecated it. Version 58 is the last major version to fully support this interface, particularly the install subcommand, thence afterward unmaintained and acting collateral damage in favour of improved PEP-517 support.

Our USE_PYTHON=distutils has setuptools as both BUILD_DEPENDS and RUN_DEPENDS, which except for specific cases further described, is wrong. Some packages use pkg_resources included with setuptools to programatically reference resources within packages, but even this functionality has been deprecated in favour of importlib_resources, which is present in every supported (as of Q1 2023) Python standard library.

This page describes steps and strategies necessary to manage competing interests wrt setuptools. Packages that have not adopted PEP-517 or importlib_resources need to continue working but port maintainers are strongly encouraged to work with upstreams to modernise. This will also allow for more timely setuptools updates as upstream releases them.

PY_SETUPTOOLS

A new variable ${PY_SETUPTOOLS} will be introduced, in the same vein as variables for other third-party modules like ${PYNUMPY} and ${PY_BOOST}. This variable will provide the correct dependency line for setuptools based on the tooling specified. This will act as a shorthand for those packages still needing the setuptools RUN_DEPENDS and packages that have adopted PEP-517 specifying setuptools as the build backend.

devel/py-setuptools58

A new port devel/py-setuptools58 will be introduced, allowing to pin direct execution of ${PYSETUP} to this version. Packages that have adopted PEP-517 specifying setuptools as the build backend will continue using the main setuptools port, which can then be updated on a more timely basis.

Removal from RUN_DEPENDS

setuptools will be removed from RUN_DEPENDS by default. This should clean up runtime environments and reduce the dependency tree. Ports are free to re-add setuptools to RUN_DEPENDS on an individual basis if functionality is still needed at runtime.

Disable compiling bytecode

${PYDISTUTILS_INSTALLARGS} will change to not compile bytecode. For CPython, a trigger does this automatically, including cleanup.


CategoryPorts

Python/setuptools (last edited 2023-02-25T03:43:00+0000 by CharlieLi)