Skip to content

Adding Sphinx API documentation

Lauren Chambers edited this page Feb 28, 2019 · 9 revisions

In pull requests that introduces new modules, it is important to include sphinx documentation as part of the PR. To do this, simply add (or edit, if it already exists), a .rst file to the jwql/docs/source/ directory named <module_name>.rst. This file should look something like this:

***********
module_name
***********

.. automodule:: jwql.subpackage_name.module_name
    :members:
    :undoc-members:

Additionally, if it doesn't already exist, include a pointer to the new .rst file in the jwql/source/index.rst file under the API documentation section, for example:

API documentation
=================

.. toctree::
   :maxdepth: 1
   :caption: Contents:

   permissions.rst
   preview_image.rst
   utils.rst
   tests.rst
   <new_rst_file>.rst

These changes to the repository should be committed and pushed as part of the pull request.

Viewing the documentation locally

Once you edit the .rst files, you will probably want to see what they would look like integrated into the documentation. You can build and view the docs locally with the following commands:

cd jwql/docs/
make html
open build/html/index.html

Note that you will need to re-make the files every time you edit them.