| 1 |
:orphan: |
| 2 |
|
| 3 |
Simple ReadTheDocs config to publish API docs |
| 4 |
--------------------------------------------- |
| 5 |
|
| 6 |
Here is an example of a simple ReadTheDocs integration to automatically |
| 7 |
generate your documentation with Pydoctor. |
| 8 |
|
| 9 |
.. note:: This kind of integration should |
| 10 |
not be confused with `Sphinx support <sphinx-integration.html>`_ that can also be used to run |
| 11 |
pydoctor inside ReadTheDocs as part of the standard Sphinx build process. |
| 12 |
|
| 13 |
This page, on the other hand, documents **how to simply run pydoctor |
| 14 |
and publish on ReadTheDocs** by using build customizations features. |
| 15 |
|
| 16 |
This example only includes a configuration file (``.readthedocs.yaml``), |
| 17 |
but the repository must also have been |
| 18 |
integrated to ReadTheDocs (by linking your Github account and importing your project for |
| 19 |
instance or by `manual webhook configuration <https://stackoverflow.com/a/74959815>`_). |
| 20 |
|
| 21 |
The config file below assume you're cloning your repository with http(s) protocol |
| 22 |
and that repository is a GitHub instance |
| 23 |
(the value of ``--html-viewsource-base`` could vary depending on your git server). |
| 24 |
|
| 25 |
Though, a similar process can be applied to Gitea, GitLab, Bitbucket ot others git servers. |
| 26 |
|
| 27 |
Just substitute `(projectname)` and `(packagedirectory)` |
| 28 |
with the appropriate information. |
| 29 |
|
| 30 |
.. code:: yaml |
| 31 |
|
| 32 |
version: 2 |
| 33 |
build: |
| 34 |
os: "ubuntu-22.04" |
| 35 |
tools: |
| 36 |
python: "3.10" |
| 37 |
commands: |
| 38 |
- pip install pydoctor |
| 39 |
- | |
| 40 |
pydoctor \ |
| 41 |
--project-name=(projectname) \ |
| 42 |
--project-version=${READTHEDOCS_GIT_IDENTIFIER} \ |
| 43 |
--project-url=${READTHEDOCS_GIT_CLONE_URL%*.git} \ |
| 44 |
--html-viewsource-base=${READTHEDOCS_GIT_CLONE_URL%*.git}/tree/${READTHEDOCS_GIT_COMMIT_HASH} \ |
| 45 |
--html-base-url=${READTHEDOCS_CANONICAL_URL} \ |
| 46 |
--html-output $READTHEDOCS_OUTPUT/html/ \ |
| 47 |
--docformat=restructuredtext \ |
| 48 |
--intersphinx=https://docs.python.org/3/objects.inv \ |
| 49 |
./(packagedirectory) |
| 50 |
|
| 51 |
`More on ReadTheDocs build customizations <https://docs.readthedocs.io/en/stable/build-customization.html>`_. |