Skip to content

Commit b200a38

Browse files
committed
Improve discussion "Is setup.py deprecated?"
Add alternative solutions for more commands. GitHub: relates to #1415
1 parent 0c6459b commit b200a38

File tree

1 file changed

+78
-7
lines changed

1 file changed

+78
-7
lines changed

source/discussions/setup-py-deprecated.rst

+78-7
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
Is ``setup.py`` deprecated?
66
===========================
77

8-
No, :term:`setup.py` is not deprecated,
9-
it is a valid configuration file for :ref:`setuptools`
8+
No, :term:`setup.py` and :ref:`setuptools` are not deprecated.
9+
10+
Setuptools is perfectly usable as a :term:`build backend`
11+
for packaging Python projects.
12+
And :file:`setup.py` is a valid configuration file for :ref:`setuptools`
1013
that happens to be written in Python, instead of in *TOML* for example
1114
(a similar practice is used by other tools
1215
like *nox* and its :file:`nox.py` configuration file,
1316
or *pytest* and :file:`conftest.py`).
1417

15-
And of course *setuptools* itself is not deprecated either.
16-
17-
It is however deprecated to run ``python setup.py`` as a command line tool.
18+
However, ``python setup.py`` and the use of :file:`setup.py`
19+
as a command line tool are deprecated.
1820

19-
This means for example that the following commands **MUST NOT** be run anymore:
21+
This means that commands such as the following **MUST NOT** be run anymore:
2022

2123
* ``python setup.py install``
2224
* ``python setup.py develop``
@@ -28,7 +30,7 @@ What commands should be used instead?
2830
=====================================
2931

3032
+---------------------------------+----------------------------------------+
31-
| Deprecated | Current recommendation |
33+
| Deprecated | Recommendation |
3234
+=================================+========================================+
3335
| ``python setup.py install`` | ``python -m pip install .`` |
3436
+---------------------------------+----------------------------------------+
@@ -79,6 +81,75 @@ The command ``python setup.py install`` was deprecated
7981
in setuptools version *58.3.0*.
8082

8183

84+
What about other commands?
85+
==========================
86+
87+
What are some replacements for the other ``python setup.py`` commands?
88+
89+
90+
``python setup.py test``
91+
------------------------
92+
93+
The recommendation is to use a test runner such as pytest_.
94+
95+
.. _pytest: https://docs.pytest.org/
96+
97+
98+
``python setup.py check``, ``python setup.py register``, and ``python setup.py upload``
99+
---------------------------------------------------------------------------------------
100+
101+
A trusted replacement is :ref:`twine`:
102+
103+
* ``python -m twine check``
104+
* ``python -m twine register``
105+
* ``python -m twine upload``
106+
107+
108+
``python setup.py --version``
109+
-----------------------------
110+
111+
A possible replacement solution (among others) is to rely on setuptools-scm_:
112+
113+
* ``python -m setuptools-scm``
114+
115+
.. _setuptools-scm: https://setuptools-scm.readthedocs.io/en/latest/usage/#as-cli-tool
116+
117+
118+
Remaining commands
119+
------------------
120+
121+
This guide does not make suggestions of replacement solutions for those commands:
122+
123+
.. hlist::
124+
:columns: 4
125+
126+
* ``alias``
127+
* ``bdist``
128+
* ``bdist_dumb``
129+
* ``bdist_egg``
130+
* ``bdist_rpm``
131+
* ``build``
132+
* ``build_clib``
133+
* ``build_ext``
134+
* ``build_py``
135+
* ``build_scripts``
136+
* ``clean``
137+
* ``dist_info``
138+
* ``easy_install``
139+
* ``editable_wheel``
140+
* ``egg_info``
141+
* ``install``
142+
* ``install_data``
143+
* ``install_egg_info``
144+
* ``install_headers``
145+
* ``install_lib``
146+
* ``install_scripts``
147+
* ``rotate``
148+
* ``saveopts``
149+
* ``setopt``
150+
* ``upload_docs``
151+
152+
82153
What about custom commands?
83154
===========================
84155

0 commit comments

Comments
 (0)