]> git.ipfire.org Git - thirdparty/Python/cpython.git/blame - Doc/README.rst
Doc: Render version/language selector on Read the Docs (#116966)
[thirdparty/Python/cpython.git] / Doc / README.rst
CommitLineData
116aa62b
GB
1Python Documentation README
2~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
4This directory contains the reStructuredText (reST) sources to the Python
b3f1f59c
R
5documentation. You don't need to build them yourself, `prebuilt versions are
6available <https://docs.python.org/dev/download.html>`_.
116aa62b 7
1de519c6 8Documentation on authoring Python documentation, including information about
b3f1f59c 9both style and markup, is available in the "`Documenting Python
384899df 10<https://devguide.python.org/documenting/>`_" chapter of the
b3f1f59c 11developers guide.
116aa62b
GB
12
13
14Building the docs
15=================
16
590665c3
ND
17The documentation is built with several tools which are not included in this
18tree but are maintained separately and are available from
19`PyPI <https://pypi.org/>`_.
20
21* `Sphinx <https://pypi.org/project/Sphinx/>`_
22* `blurb <https://pypi.org/project/blurb/>`_
bf63e8d5 23* `python-docs-theme <https://pypi.org/project/python-docs-theme/>`_
590665c3 24
122fc136
ND
25The easiest way to install these tools is to create a virtual environment and
26install the tools into there.
116aa62b 27
116aa62b
GB
28Using make
29----------
30
d22c876d 31To get started on UNIX, you can create a virtual environment and build
55fa87b1 32documentation with the commands::
116aa62b 33
55fa87b1 34 make venv
590665c3 35 make html
716c3ac4 36
d22c876d 37The virtual environment in the ``venv`` directory will contain all the tools
55fa87b1
ŁL
38necessary to build the documentation downloaded and installed from PyPI.
39If you'd like to create the virtual environment in a different location,
40you can specify it using the ``VENVDIR`` variable.
41
42You can also skip creating the virtual environment altogether, in which case
0179a82c 43the Makefile will look for instances of ``sphinx-build`` and ``blurb``
55fa87b1
ŁL
44installed on your process ``PATH`` (configurable with the ``SPHINXBUILD`` and
45``BLURB`` variables).
1de519c6 46
590665c3 47On Windows, we try to emulate the Makefile as closely as possible with a
122fc136 48``make.bat`` file. If you need to specify the Python interpreter to use,
d22c876d 49set the PYTHON environment variable.
716c3ac4 50
116aa62b
GB
51Available make targets are:
52
d22c876d
JD
53* "clean", which removes all build files and the virtual environment.
54
55* "clean-venv", which removes the virtual environment directory.
1de519c6 56
590665c3
ND
57* "venv", which creates a virtual environment with all necessary tools
58 installed.
59
69a72039 60* "html", which builds standalone HTML files for offline viewing.
116aa62b 61
69a72039
GB
62* "htmlview", which re-uses the "html" builder, but then opens the main page
63 in your default web browser.
1de519c6 64
69a72039
GB
65* "htmlhelp", which builds HTML files and a HTML Help project file usable to
66 convert them into a single Compiled HTML (.chm) file -- these are popular
67 under Microsoft Windows, but very handy on every platform.
116aa62b 68
69a72039
GB
69 To create the CHM file, you need to run the Microsoft HTML Help Workshop
70 over the generated project (.hhp) file. The make.bat script does this for
71 you on Windows.
116aa62b 72
69a72039
GB
73* "latex", which builds LaTeX source files as input to "pdflatex" to produce
74 PDF documents.
3feef617 75
69a72039 76* "text", which builds a plain text file for each source file.
0c77a82c 77
69a72039
GB
78* "epub", which builds an EPUB document, suitable to be viewed on e-book
79 readers.
183fe81f 80
69a72039
GB
81* "linkcheck", which checks all external references to see whether they are
82 broken, redirected or malformed, and outputs this information to stdout as
83 well as a plain-text (.txt) file.
d8654cf7 84
69a72039
GB
85* "changes", which builds an overview over all versionadded/versionchanged/
86 deprecated items in the current version. This is meant as a help for the
87 writer of the "What's New" document.
5b5e81c6 88
69a72039
GB
89* "coverage", which builds a coverage overview for standard library modules and
90 C API.
d3eb5a15 91
69a72039
GB
92* "pydoc-topics", which builds a Python module containing a dictionary with
93 plain text documentation for the labels defined in
bcafab84 94 ``tools/pyspecific.py`` -- pydoc needs these to show topic and keyword help.
6b38daa8 95
69a72039 96* "check", which checks for frequent markup errors.
1de519c6 97
69a72039 98* "serve", which serves the build/html directory on port 8000.
1de519c6 99
69a72039
GB
100* "dist", (Unix only) which creates distributable archives of HTML, text,
101 PDF, and EPUB builds.
1de519c6 102
116aa62b
GB
103
104Without make
105------------
106
122fc136
ND
107First, install the tool dependencies from PyPI.
108
109Then, from the ``Doc`` directory, run ::
116aa62b 110
122fc136 111 sphinx-build -b<builder> . build/<builder>
116aa62b 112
18a364fc
GB
113where ``<builder>`` is one of html, text, latex, or htmlhelp (for explanations
114see the make targets above).
116aa62b 115
46ed90dd
JP
116Deprecation header
117==================
118
119You can define the ``outdated`` variable in ``html_context`` to show a
120red banner on each page redirecting to the "latest" version.
121
122The link points to the same page on ``/3/``, sadly for the moment the
123language is lost during the process.
124
116aa62b
GB
125
126Contributing
127============
128
384899df 129Bugs in the content should be reported to the
9dc4aae8 130`Python bug tracker <https://github.com/python/cpython/issues>`_.
116aa62b 131
590665c3 132Bugs in the toolset should be reported to the tools themselves.
116aa62b
GB
133
134You can also send a mail to the Python Documentation Team at docs@python.org,
135and we will process your request as soon as possible.
136
137If you want to help the Documentation Team, you are always welcome. Just send
138a mail to docs@python.org.