Writing Documentation#
Warning
This page assumes you have installed visualastro with an
editable install along with docs dependencies. If not,
See dev installation
Building Locally#
To create a clean build from scratch:
cd docs
make clean html
open _build/html/index.html
A clean build is required after any of the following: adding a page, renaming
or removing objects, modifying a plot, or editing conf.py or the templates.
For docstring or file content edits only, it is sufficeint to run make html.
Documenting a New Function or Class#
Export it in
src/visualastro/__init__.py.Write a NumPy-style docstring (see Docstring Rules).
Create
docs/reference/<topic>/<name>.rst:
set_limits
==========
.. currentmodule:: visualastro
.. autofunction:: set_limits
List the page, without extension, in the matching
index.rsttoctree.Rebuild and fix all warnings.
Adding a Reference Page#
Create
docs/reference/<topic>.rstwith a title, a.. currentmodule:: visualastroline and one or moreautosummaryblocks grouped by purpose.Add
<topic>to the toctree indocs/reference/index.rst.Run a clean build.
Adding a Guide or Tutorial#
Create the
.rstfile indocs/user_guide/List it, without extension, in the nearest
toctree.
Adding Plots to Documentation#
Plots are rendered dynamically at build time by the documentation.
Simply create a .py file in visualastro/examples/ and write a script
that generates the figure. Make sure the script has all of its dependencies
imported and can run standalone. Then add the plot to the documentation page:
.. plot:: ../examples/plotting/legends/<your new file>.py
:include-source: True
Then run make clean html to rebuild the docs.