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,75 @@ 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 ``
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
+
82
153
What about custom commands?
83
154
===========================
84
155
0 commit comments