| 1 |
Quick Start |
| 2 |
=========== |
| 3 |
|
| 4 |
Installation |
| 5 |
------------ |
| 6 |
|
| 7 |
Pydoctor can be installed from PyPI:: |
| 8 |
|
| 9 |
$ pip install -U pydoctor |
| 10 |
|
| 11 |
For Debian and derivatives, pydoctor can be installed with ``apt``:: |
| 12 |
|
| 13 |
$ sudo apt install pydoctor |
| 14 |
|
| 15 |
Example |
| 16 |
------- |
| 17 |
|
| 18 |
The following example uses most common options to generate pydoctor's own |
| 19 |
API docs under the ``docs/api`` folder. It will add a link to the project website |
| 20 |
in the header of each page, show a link to its source code beside every documented object |
| 21 |
and resolve links to Python standard library objects. |
| 22 |
|
| 23 |
The result looks like `this <api/index.html>`_. |
| 24 |
|
| 25 |
:: |
| 26 |
|
| 27 |
pydoctor \ |
| 28 |
--project-name=pydoctor \ |
| 29 |
--project-version=20.7.2 \ |
| 30 |
--project-url=https://github.com/twisted/pydoctor/ \ |
| 31 |
--html-viewsource-base=https://github.com/twisted/pydoctor/tree/20.7.2 \ |
| 32 |
--html-base-url=https://pydoctor.readthedocs.io/en/latest/api \ |
| 33 |
--html-output=docs/api \ |
| 34 |
--docformat=epytext \ |
| 35 |
--intersphinx=https://docs.python.org/3/objects.inv \ |
| 36 |
./pydoctor |
| 37 |
|
| 38 |
.. note:: This example assume that you have cloned and installed ``pydoctor`` |
| 39 |
and you are running the ``pydoctor`` build from Unix and the current directory |
| 40 |
is the root folder of the Python project. |
| 41 |
|
| 42 |
.. tip:: First run pydoctor with ``--docformat=plaintext`` to focus on eventual |
| 43 |
python code parsing errors. Then, enable docstring parsing by selecting another `docformat <docformat/index.html>`_. |
| 44 |
|
| 45 |
.. warning:: The ``--html-viewsource-base`` argument should point to a tag or a |
| 46 |
commit SHA rather than a branch since line numbers are not going to match otherwise |
| 47 |
when commits are added to the branch after the documentation has been published. |
| 48 |
|
| 49 |
Publish your documentation |
| 50 |
-------------------------- |
| 51 |
|
| 52 |
Output files are static HTML pages which require no extra server-side support. |
| 53 |
|
| 54 |
Here is a `GitHub Action example <publish-github-action.html>`_ to automatically |
| 55 |
publish your API documentation to your default GitHub Pages website. |
| 56 |
|
| 57 |
Here is a `ReadTheDocs configuration <publish-readthedocs.html>`_ to automatically |
| 58 |
publish your API documentation to ReadTheDocs |
| 59 |
|
| 60 |
Return codes |
| 61 |
------------ |
| 62 |
|
| 63 |
Pydoctor is a pretty verbose tool by default. It’s quite unlikely that you get a zero exit code on the first run. |
| 64 |
But don’t worry, pydoctor should have produced useful HTML pages no matter your project design or docstrings. |
| 65 |
|
| 66 |
Exit codes includes: |
| 67 |
|
| 68 |
- ``0``: All docstrings are well formatted (warnings may be printed). |
| 69 |
- ``1``: Pydoctor crashed with traceback (default Python behaviour). |
| 70 |
- ``2``: Some docstrings are mal formatted. |
| 71 |
- ``3``: Pydoctor detects some warnings and ``--warnings-as-errors`` is enabled. |