# Building single-package documentation locally¶

While developing a package and its documentation, you’ll probably want to preview what the documentation looks like when built. The quickest way to do this is with a single-package documentation build.

Keep in mind that a single-package documentation build may have many broken links because package documentation is meant to be built in the context of the package stack. To do a full-stack documentation build, see either:

Nevertheless, a single-package build is useful for checking formatting and proof-reading your work. This page describes how to run a single-package documentation build, using pipe_base as the example.

## Prerequisites¶

Before starting this tutorial, you’ll need a working lsst_distrib installation. This installation should already be set up with a command like setup lsst_distrib.

This installation needs to be a recent daily or weekly build since you’ll be compiling the pipe_base repository from its master branch. Working from the tip of the master branch is the norm for LSST software development.

Finally, the documentation build uses Documenteer and related Sphinx documentation packages. Documenteer is already installed if you are using the Rubin Conda environment (part of the usual Science Pipelines installation). If this is not the case, see the Documenteer installation documentation.

You need to clone and build the package locally. In this example, you’ll be cloning and building pipe_base:

git clone https://github.com/lsst/pipe_base
cd pipe_base
setup -k -r .
scons


Note

If you’re actively developing a package, it’s likely that you’ve already cloned and built that package.

## Building the package’s documentation¶

You can build the package’s documentation by running:

package-docs build


The built HTML is located, relative to the pipe_base directory, at doc/_build/html.

Note

The page at doc/_build/html/index.html is the homepage for single-package builds. It never appears in the pipelines.lsst.io site build but does link to all the package and module documentation directories listed in the package’s doc/manifest.yaml file.

## Deleting built documentation¶

Since Sphinx only builds files that have changed, and may not notice updated docstrings, you may need to delete the built documentation to force a clean rebuild. You can delete this built documentation by running:

package-docs clean