Skip to content

Commit dae1229

Browse files
authored
bpo-36797: Prune more legacy distutils documentation (GH-13092)
Removes more legacy distutils documentation, and more clearly marks what is left as potentially outdated, with references to setuptools as a replacement.
1 parent 0a52d73 commit dae1229

14 files changed

+60
-70
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. note::
2+
3+
This document is being retained solely until the ``setuptools`` documentation
4+
at https://setuptools.readthedocs.io/en/latest/setuptools.html
5+
independently covers all of the relevant information currently included here.

Doc/distutils/apiref.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
API Reference
55
*************
66

7+
.. seealso::
8+
9+
`New and changed setup.py arguments in setuptools <setuptools-setup-py>`_
10+
The ``setuptools`` project adds new capabilities to the ``setup`` function
11+
and other APIs, makes the API consistent across different Python versions,
12+
and is hence recommended over using ``distutils`` directly.
13+
14+
.. _setuptools-setup-py: https://setuptools.readthedocs.io/en/latest/setuptools.html#new-and-changed-setup-keywords
15+
16+
.. include:: ./_setuptools_disclaimer.rst
717

818
:mod:`distutils.core` --- Core Distutils functionality
919
======================================================

Doc/distutils/builtdist.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Creating Built Distributions
55
****************************
66

7+
.. include:: ./_setuptools_disclaimer.rst
8+
79
A "built distribution" is what you're probably used to thinking of either as a
810
"binary package" or an "installer" (depending on your background). It's not
911
necessarily binary, though, because it might contain only Python source code

Doc/distutils/commandref.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Command Reference
55
*****************
66

7+
.. include:: ./_setuptools_disclaimer.rst
8+
79
.. % \section{Building modules: the \protect\command{build} command family}
810
.. % \label{build-cmds}
911
.. % \subsubsection{\protect\command{build}}

Doc/distutils/configfile.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Writing the Setup Configuration File
55
************************************
66

7+
.. include:: ./_setuptools_disclaimer.rst
8+
79
Often, it's not possible to write down everything needed to build a distribution
810
*a priori*: you may need to get some information from the user, or from the
911
user's system, in order to proceed. As long as that information is fairly

Doc/distutils/examples.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Examples
55
********
66

7+
.. include:: ./_setuptools_disclaimer.rst
8+
79
This chapter provides a number of basic examples to help get started with
810
distutils. Additional information about using distutils can be found in the
911
Distutils Cookbook.

Doc/distutils/extending.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Extending Distutils
55
*******************
66

7+
.. include:: ./_setuptools_disclaimer.rst
8+
79
Distutils can be extended in various ways. Most extensions take the form of new
810
commands or replacements for existing commands. New commands may be written to
911
support new types of platform-specific packaging, for example, while

Doc/distutils/index.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
:ref:`distributing-index`
1313
The up to date module distribution documentations
1414

15-
This document describes the Python Distribution Utilities ("Distutils") from
16-
the module developer's point of view, describing how to use the Distutils to
17-
make Python modules and extensions easily available to a wider audience with
18-
very little overhead for build/release/install mechanics.
15+
.. include:: ./_setuptools_disclaimer.rst
1916

2017
.. note::
2118

@@ -25,6 +22,11 @@ very little overhead for build/release/install mechanics.
2522
recommendations section <https://packaging.python.org/guides/tool-recommendations/>`__
2623
in the Python Packaging User Guide for more information.
2724

25+
This document describes the Python Distribution Utilities ("Distutils") from
26+
the module developer's point of view, describing the underlying capabilities
27+
that ``setuptools`` builds on to allow Python developers to make Python modules
28+
and extensions readily available to a wider audience.
29+
2830
.. toctree::
2931
:maxdepth: 2
3032
:numbered:

Doc/distutils/introduction.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
An Introduction to Distutils
55
****************************
66

7+
.. include:: ./_setuptools_disclaimer.rst
8+
79
This document covers using the Distutils to distribute your Python modules,
810
concentrating on the role of developer/distributor: if you're looking for
911
information on installing Python modules, you should refer to the

Doc/distutils/setupscript.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Writing the Setup Script
55
************************
66

7+
.. include:: ./_setuptools_disclaimer.rst
8+
79
The setup script is the centre of all activity in building, distributing, and
810
installing modules using the Distutils. The main purpose of the setup script is
911
to describe your module distribution to the Distutils, so that the various

Doc/distutils/sourcedist.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Creating a Source Distribution
55
******************************
66

7+
.. include:: ./_setuptools_disclaimer.rst
8+
79
As shown in section :ref:`distutils-simple-example`, you use the :command:`sdist` command
810
to create a source distribution. In the simplest case, ::
911

Doc/install/index.rst

Lines changed: 19 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,10 @@
1313
.. seealso::
1414

1515
:ref:`installing-index`
16-
The up to date module installation documentations
17-
18-
.. The audience for this document includes people who don't know anything
19-
about Python and aren't about to learn the language just in order to
20-
install and maintain it for their users, i.e. system administrators.
21-
Thus, I have to be sure to explain the basics at some point:
22-
sys.path and PYTHONPATH at least. Should probably give pointers to
23-
other docs on "import site", PYTHONSTARTUP, PYTHONHOME, etc.
24-
25-
Finally, it might be useful to include all the material from my "Care
26-
and Feeding of a Python Installation" talk in here somewhere. Yow!
27-
28-
This document describes the Python Distribution Utilities ("Distutils") from the
29-
end-user's point-of-view, describing how to extend the capabilities of a
30-
standard Python installation by building and installing third-party Python
31-
modules and extensions.
16+
The up to date module installation documentation. For regular Python
17+
usage, you almost certainly want that document rather than this one.
3218

19+
.. include:: ../distutils/_setuptools_disclaimer.rst
3320

3421
.. note::
3522

@@ -46,59 +33,26 @@ modules and extensions.
4633
Introduction
4734
============
4835

49-
Although Python's extensive standard library covers many programming needs,
50-
there often comes a time when you need to add some new functionality to your
51-
Python installation in the form of third-party modules. This might be necessary
52-
to support your own programming, or to support an application that you want to
53-
use and that happens to be written in Python.
54-
55-
In the past, there has been little support for adding third-party modules to an
56-
existing Python installation. With the introduction of the Python Distribution
57-
Utilities (Distutils for short) in Python 2.0, this changed.
58-
59-
This document is aimed primarily at the people who need to install third-party
60-
Python modules: end-users and system administrators who just need to get some
61-
Python application running, and existing Python programmers who want to add some
62-
new goodies to their toolbox. You don't need to know Python to read this
63-
document; there will be some brief forays into using Python's interactive mode
64-
to explore your installation, but that's it. If you're looking for information
65-
on how to distribute your own Python modules so that others may use them, see
66-
the :ref:`distutils-index` manual. :ref:`debug-setup-script` may also be of
67-
interest.
68-
69-
70-
.. _inst-trivial-install:
71-
72-
Best case: trivial installation
73-
-------------------------------
74-
75-
In the best case, someone will have prepared a special version of the module
76-
distribution you want to install that is targeted specifically at your platform
77-
and is installed just like any other software on your platform. For example,
78-
the module developer might make an executable installer available for Windows
79-
users, an RPM package for users of RPM-based Linux systems (Red Hat, SuSE,
80-
Mandrake, and many others), a Debian package for users of Debian-based Linux
81-
systems, and so forth.
82-
83-
In that case, you would download the installer appropriate to your platform and
84-
do the obvious thing with it: run it if it's an executable installer, ``rpm
85-
--install`` it if it's an RPM, etc. You don't need to run Python or a setup
86-
script, you don't need to compile anything---you might not even need to read any
87-
instructions (although it's always a good idea to do so anyway).
88-
89-
Of course, things will not always be that easy. You might be interested in a
90-
module distribution that doesn't have an easy-to-use installer for your
91-
platform. In that case, you'll have to start with the source distribution
92-
released by the module's author/maintainer. Installing from a source
93-
distribution is not too hard, as long as the modules are packaged in the
94-
standard way. The bulk of this document is about building and installing
95-
modules from standard source distributions.
36+
In Python 2.0, the ``distutils`` API was first added to the standard library.
37+
This provided Linux distro maintainers with a standard way of converting
38+
Python projects into Linux distro packages, and system administrators with a
39+
standard way of installing them directly onto target systems.
40+
41+
In the many years since Python 2.0 was released, tightly coupling the build
42+
system and package installer to the language runtime release cycle has turned
43+
out to be problematic, and it is now recommended that projects use the
44+
``pip`` package installer and the ``setuptools`` build system, rather than
45+
using ``distutils`` directly.
46+
47+
See :ref:`installing-index` and :ref:`distributing-index` for more details.
9648

49+
This legacy documentation is being retained only until we're confident that the
50+
``setuptools`` documentation covers everything needed.
9751

9852
.. _inst-new-standard:
9953

100-
The new standard: Distutils
101-
---------------------------
54+
Distutils based source distributions
55+
------------------------------------
10256

10357
If you download a module source distribution, you can tell pretty quickly if it
10458
was packaged and distributed in the standard way, i.e. using the Distutils.

Doc/tools/susp-ignored.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ c-api/sequence,,:i2,del o[i1:i2]
44
c-api/sequence,,:i2,o[i1:i2]
55
c-api/unicode,,:end,str[start:end]
66
c-api/unicode,,:start,unicode[start:start+length]
7-
distutils/examples,267,`,This is the description of the ``foobar`` package.
7+
distutils/examples,274,`,This is the description of the ``foobar`` package.
88
distutils/setupscript,,::,
99
extending/embedding,,:numargs,"if(!PyArg_ParseTuple(args, "":numargs""))"
1010
extending/extending,,:myfunction,"PyArg_ParseTuple(args, ""D:myfunction"", &c);"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
More of the legacy distutils documentation has been either pruned, or else
2+
more clearly marked as being retained solely until the setuptools
3+
documentation covers it independently.

0 commit comments

Comments
 (0)