| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 1 | Python Documentation README |
| 2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3 | |
| 4 | This directory contains the reStructuredText (reST) sources to the Python |
| Roger | b3f1f59 | 2017-02-15 17:54:05 -0500 | [diff] [blame] | 5 | documentation. You don't need to build them yourself, `prebuilt versions are |
| 6 | available <https://docs.python.org/dev/download.html>`_. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 7 | |
| Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 8 | Documentation on authoring Python documentation, including information about |
| Roger | b3f1f59 | 2017-02-15 17:54:05 -0500 | [diff] [blame] | 9 | both style and markup, is available in the "`Documenting Python |
| Lisa Hewus Fresh | 384899d | 2017-08-30 09:37:43 -0700 | [diff] [blame] | 10 | <https://devguide.python.org/documenting/>`_" chapter of the |
| Roger | b3f1f59 | 2017-02-15 17:54:05 -0500 | [diff] [blame] | 11 | developers guide. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 12 | |
| 13 | |
| 14 | Building the docs |
| 15 | ================= |
| 16 | |
| Ned Deily | 590665c | 2017-09-07 17:17:53 -0700 | [diff] [blame] | 17 | The documentation is built with several tools which are not included in this |
| 18 | tree 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 Parrott | bf63e8d | 2018-03-01 13:02:50 -0800 | [diff] [blame] | 23 | * `python-docs-theme <https://pypi.org/project/python-docs-theme/>`_ |
| Ned Deily | 590665c | 2017-09-07 17:17:53 -0700 | [diff] [blame] | 24 | |
| Ned Deily | 122fc13 | 2017-11-27 17:07:32 -0500 | [diff] [blame] | 25 | The easiest way to install these tools is to create a virtual environment and |
| 26 | install the tools into there. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 27 | |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 28 | Using make |
| 29 | ---------- |
| 30 | |
| Jack DeVries | d22c876 | 2021-07-28 09:13:28 -0400 | [diff] [blame] | 31 | To get started on UNIX, you can create a virtual environment and build |
| Łukasz Langa | 55fa87b | 2021-08-06 20:13:59 +0200 | [diff] [blame] | 32 | documentation with the commands:: |
| Ned Deily | 590665c | 2017-09-07 17:17:53 -0700 | [diff] [blame] | 33 | |
| Łukasz Langa | 55fa87b | 2021-08-06 20:13:59 +0200 | [diff] [blame] | 34 | make venv |
| Ned Deily | 590665c | 2017-09-07 17:17:53 -0700 | [diff] [blame] | 35 | make html |
| 36 | |
| Jack DeVries | d22c876 | 2021-07-28 09:13:28 -0400 | [diff] [blame] | 37 | The virtual environment in the ``venv`` directory will contain all the tools |
| Łukasz Langa | 55fa87b | 2021-08-06 20:13:59 +0200 | [diff] [blame] | 38 | necessary to build the documentation downloaded and installed from PyPI. |
| 39 | If you'd like to create the virtual environment in a different location, |
| 40 | you can specify it using the ``VENVDIR`` variable. |
| 41 | |
| 42 | You can also skip creating the virtual environment altogether, in which case |
| 43 | the Makefile will look for instances of ``sphinxbuild`` and ``blurb`` |
| 44 | installed on your process ``PATH`` (configurable with the ``SPHINXBUILD`` and |
| 45 | ``BLURB`` variables). |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 46 | |
| Georg Brandl | 18a364f | 2014-03-10 19:26:57 +0100 | [diff] [blame] | 47 | On Windows, we try to emulate the Makefile as closely as possible with a |
| Ned Deily | 122fc13 | 2017-11-27 17:07:32 -0500 | [diff] [blame] | 48 | ``make.bat`` file. If you need to specify the Python interpreter to use, |
| Jack DeVries | d22c876 | 2021-07-28 09:13:28 -0400 | [diff] [blame] | 49 | set the PYTHON environment variable. |
| Georg Brandl | 716c3ac | 2007-08-30 18:34:23 +0000 | [diff] [blame] | 50 | |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 51 | Available make targets are: |
| 52 | |
| Jack DeVries | d22c876 | 2021-07-28 09:13:28 -0400 | [diff] [blame] | 53 | * "clean", which removes all build files and the virtual environment. |
| 54 | |
| 55 | * "clean-venv", which removes the virtual environment directory. |
| Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 56 | |
| Ned Deily | 590665c | 2017-09-07 17:17:53 -0700 | [diff] [blame] | 57 | * "venv", which creates a virtual environment with all necessary tools |
| 58 | installed. |
| 59 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 60 | * "html", which builds standalone HTML files for offline viewing. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 61 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 62 | * "htmlview", which re-uses the "html" builder, but then opens the main page |
| 63 | in your default web browser. |
| Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 64 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 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. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 68 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 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. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 72 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 73 | * "latex", which builds LaTeX source files as input to "pdflatex" to produce |
| 74 | PDF documents. |
| Christian Heimes | 3feef61 | 2008-02-11 06:19:17 +0000 | [diff] [blame] | 75 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 76 | * "text", which builds a plain text file for each source file. |
| Georg Brandl | 0c77a82 | 2008-06-10 16:37:50 +0000 | [diff] [blame] | 77 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 78 | * "epub", which builds an EPUB document, suitable to be viewed on e-book |
| 79 | readers. |
| Georg Brandl | 183fe81 | 2011-01-05 11:00:25 +0000 | [diff] [blame] | 80 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 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. |
| Christian Heimes | d8654cf | 2007-12-02 15:22:16 +0000 | [diff] [blame] | 84 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 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. |
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 88 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 89 | * "coverage", which builds a coverage overview for standard library modules and |
| 90 | C API. |
| Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 91 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 92 | * "pydoc-topics", which builds a Python module containing a dictionary with |
| 93 | plain text documentation for the labels defined in |
| Julien Palard | bcafab8 | 2022-01-27 08:57:43 +0100 | [diff] [blame] | 94 | ``tools/pyspecific.py`` -- pydoc needs these to show topic and keyword help. |
| Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 95 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 96 | * "suspicious", which checks the parsed markup for text that looks like |
| 97 | malformed and thus unconverted reST. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 98 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 99 | * "check", which checks for frequent markup errors. |
| Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 100 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 101 | * "serve", which serves the build/html directory on port 8000. |
| Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 102 | |
| Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 103 | * "dist", (Unix only) which creates distributable archives of HTML, text, |
| 104 | PDF, and EPUB builds. |
| Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 105 | |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 106 | |
| 107 | Without make |
| 108 | ------------ |
| 109 | |
| Ned Deily | 122fc13 | 2017-11-27 17:07:32 -0500 | [diff] [blame] | 110 | First, install the tool dependencies from PyPI. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 111 | |
| Ned Deily | 122fc13 | 2017-11-27 17:07:32 -0500 | [diff] [blame] | 112 | Then, from the ``Doc`` directory, run :: |
| 113 | |
| 114 | sphinx-build -b<builder> . build/<builder> |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 115 | |
| Georg Brandl | 18a364f | 2014-03-10 19:26:57 +0100 | [diff] [blame] | 116 | where ``<builder>`` is one of html, text, latex, or htmlhelp (for explanations |
| 117 | see the make targets above). |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 118 | |
| Julien Palard | 46ed90d | 2019-05-29 18:34:04 +0200 | [diff] [blame] | 119 | Deprecation header |
| 120 | ================== |
| 121 | |
| 122 | You can define the ``outdated`` variable in ``html_context`` to show a |
| 123 | red banner on each page redirecting to the "latest" version. |
| 124 | |
| 125 | The link points to the same page on ``/3/``, sadly for the moment the |
| 126 | language is lost during the process. |
| 127 | |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 128 | |
| 129 | Contributing |
| 130 | ============ |
| 131 | |
| Lisa Hewus Fresh | 384899d | 2017-08-30 09:37:43 -0700 | [diff] [blame] | 132 | Bugs in the content should be reported to the |
| slateny | 9dc4aae | 2022-05-03 07:40:36 -0700 | [diff] [blame] | 133 | `Python bug tracker <https://github.com/python/cpython/issues>`_. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 134 | |
| Ned Deily | 590665c | 2017-09-07 17:17:53 -0700 | [diff] [blame] | 135 | Bugs in the toolset should be reported to the tools themselves. |
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 136 | |
| 137 | You can also send a mail to the Python Documentation Team at docs@python.org, |
| 138 | and we will process your request as soon as possible. |
| 139 | |
| 140 | If you want to help the Documentation Team, you are always welcome. Just send |
| 141 | a mail to docs@python.org. |