Skip to content

Commit c31f900

Browse files
ncoghlanastrojuanlu
authored andcommitted
Closes #667: advise against using distutils directly
1 parent 2cd6793 commit c31f900

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

source/tutorials/packaging-projects.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,15 @@ be required, but can be omitted with newer versions of setuptools and pip.
329329
There are many more than the ones mentioned here. See
330330
:doc:`/guides/distributing-packages-using-setuptools` for more details.
331331

332+
.. note::
333+
334+
You may see some existing projects or other Python packaging tutorials that
335+
import their ``setup`` function from ``distutils.core`` rather than
336+
``setuptools``. This is a legacy approach that installers [1]_ still support
337+
for backwards compatibility purposes, but using the legacy ``distutils`` API
338+
directly in new projects is strongly discouraged, as it means that newer
339+
build commands, like ``setup.py bdist_wheel``, won't work.
340+
332341
Creating README.md
333342
------------------
334343

@@ -624,3 +633,14 @@ some things you can do:
624633
* Read about :doc:`/guides/packaging-binary-extensions`.
625634
* Consider alternatives to :ref:`setuptools` such as :ref:`flit`, :ref:`hatch`,
626635
and :ref:`poetry`.
636+
637+
----
638+
639+
.. [1] Some legacy Python environments may not have ``setuptools``
640+
pre-installed, and the operators of those environments may still be
641+
requiring users to install packages by running ``setup.py install``
642+
commands, rather than providing an installer like ``pip`` that
643+
automatically installes required build dependendencies. These
644+
environments will not be able to use many published packages until the
645+
environment is updated to provide an up to date Python package
646+
installation client (e.g. by running ``python -m ensurepip``).

0 commit comments

Comments
 (0)