-
-
Notifications
You must be signed in to change notification settings - Fork 960
Description
This project currently uses deprecated features of setuptools, some of which may be removed in the future.
-
Installing by running
setup.pydirectly, as the instructions inREADME.mdsay to do and as is done intest_installation, is deprecated. Actual breakage due to this begins in Python 3.12, where althoughsetuptoolsis still supported as a build backend and nontrivial logic can still be used insetup.py, global and virtual environments do not automatically have thesetuptoolspackage. (See theensurepipitem in the list of removals in 3.12.) This is the cause of Python 3.12: ModuleNotFoundError: No module named 'setuptools' #1640. But the deprecation is not new as of Python 3.12. The following message appears during installation (with any Python version provided the installedsetuptoolsversion is not very old, but I used Python 3.11.5):/home/ek/repos-wsl/GitPython/.venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !!This could be worked around without a fix by adding
setuptoolsas a development dependency, but an actual fix is straightforward, and there are some further benefits to usingpip install .to install locally, including that-ecan easily be passed to make the installation editable. -
Building by running
setup.pydirectly is, if I understand correctly, also deprecated. This is a less serious problem, but a true fix for this is also straightforward: thebuildmodule can be added as a development dependency and used for building the sdist and wheel inMakefile. Thesetuptoolsdocumentation recommends usingbuild. -
The
tests_requirekeyword argument is deprecated and intended for removal in a future version ofsetuptools, as noted in thesetuptools.setupkeyword arguments documentation.This is already not achieving what appears intended or least hoped for (see Readme claims test dependencies are installed automatically #1652), and one reasonable way to fix this is to remove that argument altogether. But both the reliance on a deprecated feature and the absence of an automated way to install test dependencies as a group (without
pip install -rcommands) could be remedied by using atestextra rather thantests_require.
Although I worry a bit about broad scope, it seems to me that it is natural to fix #1640, #1651, #1652, and this issue (which itself overlaps with #1640 and #1652, though is not limited to them) in a single pull request. I say this because there is significant overlap in the changes, and because decisions made in review should probably take the considerations of all these issues into account. I've opened #1654 for this.
Note that while it is today discouraged to implement nontrivial logic in setup.py, and recommended to use pyproject.toml and/or setup.cfg for what has traditionally been done in setup.py, I do not believe it is deprecated to make nontrivial use of setup.py as this project does. Although it would be beneficial to define build and installation rules declaratively, I think that would be a much bigger change than needed to fix this issue. I have not attempted to do anything like that at this time.