Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. 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 [[https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html|long considered the command line interface fragile]] and officially deprecated it. [[https://setuptools.pypa.io/en/latest/history.html#v58-3-0|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 [[Python/PEP-517|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, and is only valid for the port that it is used in. ===== Removal from RUN_DEPENDS ===== setuptools will be removed from ''%%RUN_DEPENDS%%'' to clean up runtime environments and reduce the dependency tree. Ports shall never specify ''%%RUN_DEPENDS=${PY_SETUPTOOLS}%%'' except in the following cases: * Leaf ports (no further consumers) * Helper ports of PEP-517 build backends that use ''%%devel/py-setuptools-scm%%'' to derive versions from source code management systems (git, mercurial, etc). Other ports shall not specify these as ''%%RUN_DEPENDS%%''. Any consumers not covered by the above exceptions should add ''%%BUILD_DEPENDS=${PY_SETUPTOOLS}%%'' directly if not ''%%USE_PYTHON=distutils%%'', or preferably, work to remove the run dependency entirely. Different versions of setuptools cannot exist in the same environment. ===== devel/py-setuptools58 ===== A new port ''%%devel/py-setuptools58%%'' will be introduced, allowing to pin direct execution of ''%%${PYSETUP}%%'', ie ''%%USE_PYTHON=distutils%%'', 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. ===== Disable compiling bytecode ===== ''%%${PYDISTUTILS_INSTALLARGS}%%'' will change to not compile bytecode. For CPython, [[Python/CompiledPackages|a trigger does this automatically, including cleanup]]. ---- {{tag>Ports}} python/setuptools.txt Last modified: 2023/10/12 07:30by CharlieLi