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 | |
Roger | b3f1f59 | 2017-02-15 17:54:05 -0500 | [diff] [blame] | 17 | You need to have `Sphinx <http://sphinx-doc.org/>`_ installed; it is the toolset |
Georg Brandl | 02e77d1 | 2014-03-10 19:31:52 +0100 | [diff] [blame] | 18 | used to build the docs. It is not included in this tree, but maintained |
Roger | b3f1f59 | 2017-02-15 17:54:05 -0500 | [diff] [blame] | 19 | separately and `available from PyPI <https://pypi.python.org/pypi/Sphinx>`_. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 20 | |
| 21 | |
| 22 | Using make |
| 23 | ---------- |
| 24 | |
Georg Brandl | 02e77d1 | 2014-03-10 19:31:52 +0100 | [diff] [blame] | 25 | A Makefile has been prepared so that on Unix, provided you have installed |
| 26 | Sphinx, you can just run :: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 27 | |
| 28 | make html |
| 29 | |
Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 30 | to build the HTML output files. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 31 | |
Georg Brandl | 18a364f | 2014-03-10 19:26:57 +0100 | [diff] [blame] | 32 | On Windows, we try to emulate the Makefile as closely as possible with a |
| 33 | ``make.bat`` file. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 34 | |
Georg Brandl | 716c3ac | 2007-08-30 18:34:23 +0000 | [diff] [blame] | 35 | To use a Python interpreter that's not called ``python``, use the standard |
| 36 | way to set Makefile variables, using e.g. :: |
| 37 | |
Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 38 | make html PYTHON=python3 |
| 39 | |
| 40 | On Windows, set the PYTHON environment variable instead. |
| 41 | |
| 42 | To use a specific sphinx-build (something other than ``sphinx-build``), set |
| 43 | the SPHINXBUILD variable. |
Georg Brandl | 716c3ac | 2007-08-30 18:34:23 +0000 | [diff] [blame] | 44 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 45 | Available make targets are: |
| 46 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 47 | * "clean", which removes all build files. |
Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 48 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 49 | * "html", which builds standalone HTML files for offline viewing. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 50 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 51 | * "htmlview", which re-uses the "html" builder, but then opens the main page |
| 52 | in your default web browser. |
Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 53 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 54 | * "htmlhelp", which builds HTML files and a HTML Help project file usable to |
| 55 | convert them into a single Compiled HTML (.chm) file -- these are popular |
| 56 | under Microsoft Windows, but very handy on every platform. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 57 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 58 | To create the CHM file, you need to run the Microsoft HTML Help Workshop |
| 59 | over the generated project (.hhp) file. The make.bat script does this for |
| 60 | you on Windows. |
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 | * "latex", which builds LaTeX source files as input to "pdflatex" to produce |
| 63 | PDF documents. |
Christian Heimes | 3feef61 | 2008-02-11 06:19:17 +0000 | [diff] [blame] | 64 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 65 | * "text", which builds a plain text file for each source file. |
Georg Brandl | 0c77a82 | 2008-06-10 16:37:50 +0000 | [diff] [blame] | 66 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 67 | * "epub", which builds an EPUB document, suitable to be viewed on e-book |
| 68 | readers. |
Georg Brandl | 183fe81 | 2011-01-05 11:00:25 +0000 | [diff] [blame] | 69 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 70 | * "linkcheck", which checks all external references to see whether they are |
| 71 | broken, redirected or malformed, and outputs this information to stdout as |
| 72 | well as a plain-text (.txt) file. |
Christian Heimes | d8654cf | 2007-12-02 15:22:16 +0000 | [diff] [blame] | 73 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 74 | * "changes", which builds an overview over all versionadded/versionchanged/ |
| 75 | deprecated items in the current version. This is meant as a help for the |
| 76 | writer of the "What's New" document. |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 77 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 78 | * "coverage", which builds a coverage overview for standard library modules and |
| 79 | C API. |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 80 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 81 | * "pydoc-topics", which builds a Python module containing a dictionary with |
| 82 | plain text documentation for the labels defined in |
| 83 | `tools/pyspecific.py` -- pydoc needs these to show topic and keyword help. |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 84 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 85 | * "suspicious", which checks the parsed markup for text that looks like |
| 86 | malformed and thus unconverted reST. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 87 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 88 | * "check", which checks for frequent markup errors. |
Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 89 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 90 | * "serve", which serves the build/html directory on port 8000. |
Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 91 | |
Georg Brandl | 69a7203 | 2014-10-29 08:18:43 +0100 | [diff] [blame] | 92 | * "dist", (Unix only) which creates distributable archives of HTML, text, |
| 93 | PDF, and EPUB builds. |
Zachary Ware | 1de519c | 2014-04-29 09:26:56 -0500 | [diff] [blame] | 94 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 95 | |
| 96 | Without make |
| 97 | ------------ |
| 98 | |
Georg Brandl | 18a364f | 2014-03-10 19:26:57 +0100 | [diff] [blame] | 99 | Install the Sphinx package and its dependencies from PyPI. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 100 | |
Zachary Ware | a37ff0f | 2014-04-18 15:10:40 -0500 | [diff] [blame] | 101 | Then, from the ``Doc`` directory, run :: |
Georg Brandl | d94b4a7 | 2010-03-13 10:56:09 +0000 | [diff] [blame] | 102 | |
Georg Brandl | 18a364f | 2014-03-10 19:26:57 +0100 | [diff] [blame] | 103 | sphinx-build -b<builder> . build/<builder> |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 104 | |
Georg Brandl | 18a364f | 2014-03-10 19:26:57 +0100 | [diff] [blame] | 105 | where ``<builder>`` is one of html, text, latex, or htmlhelp (for explanations |
| 106 | see the make targets above). |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 107 | |
| 108 | |
| 109 | Contributing |
| 110 | ============ |
| 111 | |
Lisa Hewus Fresh | 384899d | 2017-08-30 09:37:43 -0700 | [diff] [blame] | 112 | Bugs in the content should be reported to the |
Roger | b3f1f59 | 2017-02-15 17:54:05 -0500 | [diff] [blame] | 113 | `Python bug tracker <https://bugs.python.org>`_. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 114 | |
Lisa Hewus Fresh | 384899d | 2017-08-30 09:37:43 -0700 | [diff] [blame] | 115 | Bugs in the toolset should be reported in the |
Roger | b3f1f59 | 2017-02-15 17:54:05 -0500 | [diff] [blame] | 116 | `Sphinx bug tracker <https://github.com/sphinx-doc/sphinx/issues>`_. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 117 | |
| 118 | You can also send a mail to the Python Documentation Team at docs@python.org, |
| 119 | and we will process your request as soon as possible. |
| 120 | |
| 121 | If you want to help the Documentation Team, you are always welcome. Just send |
| 122 | a mail to docs@python.org. |