5
5
Is ``setup.py `` deprecated?
6
6
===========================
7
7
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 `
10
13
that happens to be written in Python, instead of in *TOML * for example
11
14
(a similar practice is used by other tools
12
15
like *nox * and its :file: `nox.py ` configuration file,
13
16
or *pytest * and :file: `conftest.py `).
14
17
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.
18
20
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:
20
22
21
23
* ``python setup.py install ``
22
24
* ``python setup.py develop ``
@@ -28,7 +30,7 @@ What commands should be used instead?
28
30
=====================================
29
31
30
32
+---------------------------------+----------------------------------------+
31
- | Deprecated | Current recommendation |
33
+ | Deprecated | Recommendation |
32
34
+=================================+========================================+
33
35
| ``python setup.py install `` | ``python -m pip install . `` |
34
36
+---------------------------------+----------------------------------------+
@@ -79,6 +81,78 @@ The command ``python setup.py install`` was deprecated
79
81
in setuptools version *58.3.0 *.
80
82
81
83
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 --strict dist/* ``
104
+ * ``python -m twine register dist/*.whl `` [#not-pypi ]_
105
+ * ``python -m twine upload dist/* ``
106
+
107
+ .. [#not-pypi ] Not necessary, nor supported on :term: `PyPI <Python Package Index (PyPI)> `.
108
+ But might be necessary on other :term: `package indexes <package index> ` (for example :ref: `devpi `).
109
+
110
+
111
+ ``python setup.py --version ``
112
+ -----------------------------
113
+
114
+ A possible replacement solution (among others) is to rely on setuptools-scm _:
115
+
116
+ * ``python -m setuptools_scm ``
117
+
118
+ .. _setuptools-scm : https://setuptools-scm.readthedocs.io/en/latest/usage/#as-cli-tool
119
+
120
+
121
+ Remaining commands
122
+ ------------------
123
+
124
+ This guide does not make suggestions of replacement solutions for those commands:
125
+
126
+ .. hlist ::
127
+ :columns: 4
128
+
129
+ * ``alias ``
130
+ * ``bdist ``
131
+ * ``bdist_dumb ``
132
+ * ``bdist_egg ``
133
+ * ``bdist_rpm ``
134
+ * ``build ``
135
+ * ``build_clib ``
136
+ * ``build_ext ``
137
+ * ``build_py ``
138
+ * ``build_scripts ``
139
+ * ``clean ``
140
+ * ``dist_info ``
141
+ * ``easy_install ``
142
+ * ``editable_wheel ``
143
+ * ``egg_info ``
144
+ * ``install ``
145
+ * ``install_data ``
146
+ * ``install_egg_info ``
147
+ * ``install_headers ``
148
+ * ``install_lib ``
149
+ * ``install_scripts ``
150
+ * ``rotate ``
151
+ * ``saveopts ``
152
+ * ``setopt ``
153
+ * ``upload_docs ``
154
+
155
+
82
156
What about custom commands?
83
157
===========================
84
158
0 commit comments