From 65939fac14927f58de93ceaa1704507a8a5b7eb3 Mon Sep 17 00:00:00 2001 From: sinoroc Date: Sun, 26 Nov 2023 11:45:19 +0100 Subject: [PATCH] Improve discussion "Is `setup.py` deprecated?" Add alternative solutions for more commands. GitHub: relates to https://github.com/pypa/packaging.python.org/pull/1415 --- source/discussions/setup-py-deprecated.rst | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/source/discussions/setup-py-deprecated.rst b/source/discussions/setup-py-deprecated.rst index 25bba70a9b..ec7f89bf98 100644 --- a/source/discussions/setup-py-deprecated.rst +++ b/source/discussions/setup-py-deprecated.rst @@ -16,7 +16,7 @@ And of course *setuptools* itself is not deprecated either. It is however deprecated to run ``python setup.py`` as a command line tool. -This means for example that the following commands **MUST NOT** be run anymore: +This means that commands such as the following **MUST NOT** be run anymore: * ``python setup.py install`` * ``python setup.py develop`` @@ -28,7 +28,7 @@ What commands should be used instead? ===================================== +---------------------------------+----------------------------------------+ -| Deprecated | Current recommendation | +| Deprecated | Recommendation | +=================================+========================================+ | ``python setup.py install`` | ``python -m pip install .`` | +---------------------------------+----------------------------------------+ @@ -79,6 +79,33 @@ The command ``python setup.py install`` was deprecated in setuptools version *58.3.0*. +What about other commands? +========================== + +.. rubric:: ``python setup.py test`` + +The recommendation is to use a test runner such as pytest_. + +.. _pytest: https://docs.pytest.org/ + + +.. rubric:: ``python setup.py check`` and ``python setup.py upload`` + +A trusted replacement is :ref:`twine`: + +* ``python -m twine check`` +* ``python -m twine upload`` + + +.. rubric:: ``python setup.py --version`` + +A possible replacement solution (among others) is to rely on setuptools-scm_: + +* ``python -m setuptools-scm`` + +.. _setuptools-scm: https://setuptools-scm.readthedocs.io/en/latest/usage/#as-cli-tool + + What about custom commands? ===========================