bpo-41282: Add deprecation warning and docs for distutils (PEP 632) (… · python/cpython@62949f6 (original) (raw)

6 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -12,6 +12,13 @@
12 12 :ref:`distributing-index`
13 13 The up to date module distribution documentations
14 14
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 +
15 22 .. include:: ./_setuptools_disclaimer.rst
16 23
17 24 .. note::
Original file line number Diff line number Diff line change
@@ -10,6 +10,13 @@
10 10
11 11 .. TODO: Fill in XXX comments
12 12
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 +
13 20 .. seealso::
14 21
15 22 :ref:`installing-index`
Original file line number Diff line number Diff line change
@@ -9,6 +9,11 @@
9 9
10 10 --------------
11 11
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 +
12 17 The :mod:`distutils` package provides support for building and installing
13 18 additional modules into a Python installation. The new modules may be either
14 19 100%-pure Python, or may be extension modules written in C, or may be
Original file line number Diff line number Diff line change
@@ -341,9 +341,21 @@ The ``BUTTON5_*`` constants are now exposed in the :mod:`curses` module if
341 341 they are provided by the underlying curses library.
342 342 (Contributed by Zackery Spytz in :issue:`39273`.)
343 343
344 +.. _distutils-deprecated:
345 +
344 346 distutils
345 347 ---------
346 348
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 +
347 359 The ``bdist_wininst`` command deprecated in Python 3.8 has been removed.
348 360 The ``bdist_wheel`` command is now recommended to distribute binary packages
349 361 on Windows.
@@ -583,6 +595,10 @@ Deprecated
583 595 as appropriate to help identify code which needs updating during
584 596 this transition.
585 597
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 +
586 602 * Non-integer arguments to :func:`random.randrange` are deprecated.
587 603 The :exc:`ValueError` is deprecated in favor of a :exc:`TypeError`.
588 604 (Contributed by Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)
Original file line number Diff line number Diff line change
@@ -9,5 +9,11 @@
9 9 """
10 10
11 11 import sys
12 +import warnings
12 13
13 14 __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 number Diff line number Diff line change
@@ -0,0 +1 @@
1 +Deprecate ``distutils`` in documentation and add warning on import.