blob: 4326086e9e3529954e6ddac7a145f728e61d3f7a [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001Python Documentation README
2~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
4This directory contains the reStructuredText (reST) sources to the Python
Rogerb3f1f592017-02-15 17:54:05 -05005documentation. You don't need to build them yourself, `prebuilt versions are
6available <https://docs.python.org/dev/download.html>`_.
Georg Brandl116aa622007-08-15 14:28:22 +00007
Zachary Ware1de519c2014-04-29 09:26:56 -05008Documentation on authoring Python documentation, including information about
Rogerb3f1f592017-02-15 17:54:05 -05009both style and markup, is available in the "`Documenting Python
Lisa Hewus Fresh384899d2017-08-30 09:37:43 -070010<https://devguide.python.org/documenting/>`_" chapter of the
Rogerb3f1f592017-02-15 17:54:05 -050011developers guide.
Georg Brandl116aa622007-08-15 14:28:22 +000012
13
14Building the docs
15=================
16
Ned Deily590665c2017-09-07 17:17:53 -070017The 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/>`_
Jon Wayne Parrottbf63e8d2018-03-01 13:02:50 -080023* `python-docs-theme <https://pypi.org/project/python-docs-theme/>`_
Ned Deily590665c2017-09-07 17:17:53 -070024
Ned Deily122fc132017-11-27 17:07:32 -050025The easiest way to install these tools is to create a virtual environment and
26install the tools into there.
Georg Brandl116aa622007-08-15 14:28:22 +000027
Georg Brandl116aa622007-08-15 14:28:22 +000028Using make
29----------
30
Jack DeVriesd22c8762021-07-28 09:13:28 -040031To get started on UNIX, you can create a virtual environment and build
Łukasz Langa55fa87b2021-08-06 20:13:59 +020032documentation with the commands::
Ned Deily590665c2017-09-07 17:17:53 -070033
Łukasz Langa55fa87b2021-08-06 20:13:59 +020034 make venv
Ned Deily590665c2017-09-07 17:17:53 -070035 make html
36
Jack DeVriesd22c8762021-07-28 09:13:28 -040037The virtual environment in the ``venv`` directory will contain all the tools
Łukasz Langa55fa87b2021-08-06 20:13:59 +020038necessary 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
43the Makefile will look for instances of ``sphinxbuild`` and ``blurb``
44installed on your process ``PATH`` (configurable with the ``SPHINXBUILD`` and
45``BLURB`` variables).
Georg Brandl116aa622007-08-15 14:28:22 +000046
Georg Brandl18a364f2014-03-10 19:26:57 +010047On Windows, we try to emulate the Makefile as closely as possible with a
Ned Deily122fc132017-11-27 17:07:32 -050048``make.bat`` file. If you need to specify the Python interpreter to use,
Jack DeVriesd22c8762021-07-28 09:13:28 -040049set the PYTHON environment variable.
Georg Brandl716c3ac2007-08-30 18:34:23 +000050
Georg Brandl116aa622007-08-15 14:28:22 +000051Available make targets are:
52
Jack DeVriesd22c8762021-07-28 09:13:28 -040053* "clean", which removes all build files and the virtual environment.
54
55* "clean-venv", which removes the virtual environment directory.
Zachary Ware1de519c2014-04-29 09:26:56 -050056
Ned Deily590665c2017-09-07 17:17:53 -070057* "venv", which creates a virtual environment with all necessary tools
58 installed.
59
Georg Brandl69a72032014-10-29 08:18:43 +010060* "html", which builds standalone HTML files for offline viewing.
Georg Brandl116aa622007-08-15 14:28:22 +000061
Georg Brandl69a72032014-10-29 08:18:43 +010062* "htmlview", which re-uses the "html" builder, but then opens the main page
63 in your default web browser.
Zachary Ware1de519c2014-04-29 09:26:56 -050064
Georg Brandl69a72032014-10-29 08:18:43 +010065* "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.
Georg Brandl116aa622007-08-15 14:28:22 +000068
Georg Brandl69a72032014-10-29 08:18:43 +010069 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.
Georg Brandl116aa622007-08-15 14:28:22 +000072
Georg Brandl69a72032014-10-29 08:18:43 +010073* "latex", which builds LaTeX source files as input to "pdflatex" to produce
74 PDF documents.
Christian Heimes3feef612008-02-11 06:19:17 +000075
Georg Brandl69a72032014-10-29 08:18:43 +010076* "text", which builds a plain text file for each source file.
Georg Brandl0c77a822008-06-10 16:37:50 +000077
Georg Brandl69a72032014-10-29 08:18:43 +010078* "epub", which builds an EPUB document, suitable to be viewed on e-book
79 readers.
Georg Brandl183fe812011-01-05 11:00:25 +000080
Georg Brandl69a72032014-10-29 08:18:43 +010081* "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.
Christian Heimesd8654cf2007-12-02 15:22:16 +000084
Georg Brandl69a72032014-10-29 08:18:43 +010085* "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.
Christian Heimes5b5e81c2007-12-31 16:14:33 +000088
Georg Brandl69a72032014-10-29 08:18:43 +010089* "coverage", which builds a coverage overview for standard library modules and
90 C API.
Christian Heimesd3eb5a152008-02-24 00:38:49 +000091
Georg Brandl69a72032014-10-29 08:18:43 +010092* "pydoc-topics", which builds a Python module containing a dictionary with
93 plain text documentation for the labels defined in
Julien Palardbcafab82022-01-27 08:57:43 +010094 ``tools/pyspecific.py`` -- pydoc needs these to show topic and keyword help.
Georg Brandl6b38daa2008-06-01 21:05:17 +000095
Georg Brandl69a72032014-10-29 08:18:43 +010096* "suspicious", which checks the parsed markup for text that looks like
97 malformed and thus unconverted reST.
Georg Brandl116aa622007-08-15 14:28:22 +000098
Georg Brandl69a72032014-10-29 08:18:43 +010099* "check", which checks for frequent markup errors.
Zachary Ware1de519c2014-04-29 09:26:56 -0500100
Georg Brandl69a72032014-10-29 08:18:43 +0100101* "serve", which serves the build/html directory on port 8000.
Zachary Ware1de519c2014-04-29 09:26:56 -0500102
Georg Brandl69a72032014-10-29 08:18:43 +0100103* "dist", (Unix only) which creates distributable archives of HTML, text,
104 PDF, and EPUB builds.
Zachary Ware1de519c2014-04-29 09:26:56 -0500105
Georg Brandl116aa622007-08-15 14:28:22 +0000106
107Without make
108------------
109
Ned Deily122fc132017-11-27 17:07:32 -0500110First, install the tool dependencies from PyPI.
Georg Brandl116aa622007-08-15 14:28:22 +0000111
Ned Deily122fc132017-11-27 17:07:32 -0500112Then, from the ``Doc`` directory, run ::
113
114 sphinx-build -b<builder> . build/<builder>
Georg Brandl116aa622007-08-15 14:28:22 +0000115
Georg Brandl18a364f2014-03-10 19:26:57 +0100116where ``<builder>`` is one of html, text, latex, or htmlhelp (for explanations
117see the make targets above).
Georg Brandl116aa622007-08-15 14:28:22 +0000118
Julien Palard46ed90d2019-05-29 18:34:04 +0200119Deprecation header
120==================
121
122You can define the ``outdated`` variable in ``html_context`` to show a
123red banner on each page redirecting to the "latest" version.
124
125The link points to the same page on ``/3/``, sadly for the moment the
126language is lost during the process.
127
Georg Brandl116aa622007-08-15 14:28:22 +0000128
129Contributing
130============
131
Lisa Hewus Fresh384899d2017-08-30 09:37:43 -0700132Bugs in the content should be reported to the
slateny9dc4aae2022-05-03 07:40:36 -0700133`Python bug tracker <https://github.com/python/cpython/issues>`_.
Georg Brandl116aa622007-08-15 14:28:22 +0000134
Ned Deily590665c2017-09-07 17:17:53 -0700135Bugs in the toolset should be reported to the tools themselves.
Georg Brandl116aa622007-08-15 14:28:22 +0000136
137You can also send a mail to the Python Documentation Team at docs@python.org,
138and we will process your request as soon as possible.
139
140If you want to help the Documentation Team, you are always welcome. Just send
141a mail to docs@python.org.