Skip to content

Commit 62949f6

Browse files
authored
bpo-41282: Add deprecation warning and docs for distutils (PEP 632) (GH-24355)
1 parent 6baaae5 commit 62949f6

File tree

6 files changed

+42
-0
lines changed

6 files changed

+42
-0
lines changed

Doc/distutils/index.rst

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
:ref:`distributing-index`
1313
The up to date module distribution documentations
1414

15+
.. note::
16+
17+
The entire ``distutils`` package has been deprecated and will be
18+
removed in Python 3.12. This documentation is retained as a
19+
reference only, and will be removed with the package. See the
20+
:ref:`What's New <distutils-deprecated>` entry for more information.
21+
1522
.. include:: ./_setuptools_disclaimer.rst
1623

1724
.. note::

Doc/install/index.rst

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
.. TODO: Fill in XXX comments
1212
13+
.. note::
14+
15+
The entire ``distutils`` package has been deprecated and will be
16+
removed in Python 3.12. This documentation is retained as a
17+
reference only, and will be removed with the package. See the
18+
:ref:`What's New <distutils-deprecated>` entry for more information.
19+
1320
.. seealso::
1421

1522
:ref:`installing-index`

Doc/library/distutils.rst

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
--------------
1111

12+
:mod:`distutils` is deprecated with removal planned for Python 3.12.
13+
See the :ref:`What's New <distutils-deprecated>` entry for more information.
14+
15+
--------------
16+
1217
The :mod:`distutils` package provides support for building and installing
1318
additional modules into a Python installation. The new modules may be either
1419
100%-pure Python, or may be extension modules written in C, or may be

Doc/whatsnew/3.10.rst

+16
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,21 @@ The ``BUTTON5_*`` constants are now exposed in the :mod:`curses` module if
341341
they are provided by the underlying curses library.
342342
(Contributed by Zackery Spytz in :issue:`39273`.)
343343
344+
.. _distutils-deprecated:
345+
344346
distutils
345347
---------
346348
349+
The entire ``distutils`` package is deprecated, to be removed in Python
350+
3.12. Its functionality for specifying package builds has already been
351+
completely replaced by third-party packages ``setuptools`` and
352+
``packaging``, and most other commonly used APIs are available elsewhere
353+
in the standard library (such as :mod:`platform`, :mod:`shutil`,
354+
:mod:`subprocess` or :mod:`sysconfig`). There are no plans to migrate
355+
any other functionality from ``distutils``, and applications that are
356+
using other functions should plan to make private copies of the code.
357+
Refer to :pep:`632` for discussion.
358+
347359
The ``bdist_wininst`` command deprecated in Python 3.8 has been removed.
348360
The ``bdist_wheel`` command is now recommended to distribute binary packages
349361
on Windows.
@@ -583,6 +595,10 @@ Deprecated
583595
as appropriate to help identify code which needs updating during
584596
this transition.
585597
598+
* The entire ``distutils`` namespace is deprecated, to be removed in
599+
Python 3.12. Refer to the :ref:`module changes <distutils-deprecated>`
600+
section for more information.
601+
586602
* Non-integer arguments to :func:`random.randrange` are deprecated.
587603
The :exc:`ValueError` is deprecated in favor of a :exc:`TypeError`.
588604
(Contributed by Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)

Lib/distutils/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@
99
"""
1010

1111
import sys
12+
import warnings
1213

1314
__version__ = sys.version[:sys.version.index(' ')]
15+
16+
warnings.warn("The distutils package deprecated and slated for "
17+
"removal in Python 3.12. Use setuptools or check "
18+
"PEP 632 for potential alternatives",
19+
DeprecationWarning)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deprecate ``distutils`` in documentation and add warning on import.

0 commit comments

Comments
 (0)