Skip to content

Commit

Permalink
Update API reference docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lochhh committed Jul 2, 2024
1 parent 5e039c0 commit aa014b5
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,32 +209,14 @@ If it is not yet defined and you have multiple external links pointing to the sa


### Updating the API reference
If your PR introduces new public modules, or renames existing ones,
make sure to add them to the `docs/source/api_index.rst` page, so that they are included in the [API reference](target-api), e.g.:

```rst
API Reference
=============
Information on specific functions, classes, and methods.
.. rubric:: Modules
.. autosummary::
:toctree: api
:recursive:
:nosignatures:
movement.move_accessor
movement.io.load_poses
movement.io.save_poses
movement.your_new_module
```

The API reference is auto-generated by the `sphinx-autodoc` and `sphinx-autosummary` plugins, based on docstrings.
The API reference is auto-generated by the `docs/make_api_index.py` script, and the `sphinx-autodoc` and `sphinx-autosummary` plugins.
The script generates the `docs/source/api_index.rst` file containing the list of modules to be included in the [API reference](target-api).
The plugins then generate the API reference pages for each module listed in `api_index.rst`, based on the docstrings in the source code.
So make sure that all your public functions/classes/methods have valid docstrings following the [numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) style.
Our `pre-commit` hooks include some checks (`ruff` rules) that ensure the docstrings are formatted consistently.

If your PR introduces new modules that should not be documented in the [API reference](target-api), or if there are changes to existing modules that necessitate their removal from the documentation, make sure to update the `exclude_modules` list within the `docs/make_api_index.py` script to reflect these exclusions.

### Updating the examples
We use [sphinx-gallery](sphinx-gallery:)
to create the [examples](target-examples).
Expand All @@ -259,14 +241,14 @@ pip install -r docs/requirements.txt

Then, from the root of the repository, run:
```sh
sphinx-build docs/source docs/build
python docs/make_api_index.py && sphinx-build docs/source docs/build
```

You can view the local build by opening `docs/build/index.html` in a browser.
To refresh the documentation, after making changes, remove the `docs/build` folder and re-run the above command:

```sh
rm -rf docs/build && sphinx-build docs/source docs/build
rm -rf docs/build && python docs/make_api_index.py && sphinx-build docs/source docs/build
```

To check that external links are correctly resolved, run:
Expand Down

0 comments on commit aa014b5

Please sign in to comment.