# Build System Configuration

> Use when when you have a Python package with source modules that need to be documented, want to generate API stubs automatically from docstrings, and need to produce browsable HTML documentation for distribution or hosting (e.g., on ReadTheDocs).

- Skill: `holobiomicslab/build-system-configuration` (Agent Skill)
- Install (CLI): `npx skillmds@latest add holobiomicslab/build-system-configuration`
- Raw SKILL.md: https://api.skillmd.com/api/skills/holobiomicslab/build-system-configuration/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- License: CC-BY-4.0
- Author: HolobiomicsLab (https://skillmd.com/u/holobiomicslab)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/holobiomicslab/build-system-configuration

---


# Build System Configuration

## Summary

Configure and execute a documentation build system using Sphinx to generate API stubs from source code and compile them into browsable HTML output. This skill ensures reproducible, automated generation of API documentation from live source modules.

## When to use

When you have a Python package with source modules that need to be documented, want to generate API stubs automatically from docstrings, and need to produce browsable HTML documentation for distribution or hosting (e.g., on ReadTheDocs). Triggered by the presence of a Sphinx configuration, source modules, and a requirement for automated, version-controlled documentation builds.

## When NOT to use

- Documentation already exists in compiled form (HTML, PDF) and does not need regeneration.
- Source code lacks docstrings or structured documentation; Sphinx-apidoc will produce empty or minimal stubs.
- Build environment lacks write permissions to the documentation directory or _build output path.

## Inputs

- requirements.txt (Python dependency specification)
- Source module directory (e.g., ../dreams with .py files)
- Sphinx conf.py (build configuration)
- Tutorial or reference directories (optional external content)
- Sphinx source files (.rst files in documentation directory)

## Outputs

- Generated API stub files (.rst) from sphinx-apidoc
- Compiled HTML documentation tree in _build/html/
- index.html (browsable entry point)
- Complete API reference with cross-linked pages

## How to apply

First, install Python dependencies from a requirements.txt file using pip to ensure all Sphinx and build tools are available in the environment. Second, link external tutorial or reference directories into the documentation source tree using symbolic links (e.g., `ln -s ../tutorials tutorials`) so they are discoverable by the build process. Third, run `sphinx-apidoc` to scan the source module directory (e.g., `../dreams`) and auto-generate reStructuredText stub files in the current documentation directory; this creates API documentation anchors from module docstrings. Finally, execute `make html` to invoke the Sphinx build system, which processes all source files and outputs compiled HTML documentation to `_build/html/`. Verify successful build by checking for the index.html file in the output directory and testing navigation in a browser.

## Related tools

- **pip** (Installs Python dependencies (Sphinx, extensions, build tools) specified in requirements.txt into the active environment) — https://pip.pypa.io/
- **Sphinx** (Orchestrates the entire documentation build: sphinx-apidoc auto-generates API stubs from source docstrings, and make html compiles reStructuredText into browsable HTML output) — https://www.sphinx-doc.org/
- **sphinx-apidoc** (Scans a Python module directory and auto-generates reStructuredText (.rst) stub files for API documentation, extracting docstrings and module metadata) — https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html
- **make** (Executes the Makefile generated by Sphinx to invoke the html build target, processing all source files and generating the final HTML output)

## Examples

```
pip install -r requirements.txt && ln -s ../tutorials tutorials && sphinx-apidoc -o . ../dreams && make html && open _build/html/index.html
```

## Evaluation signals

- Exit code 0 from `pip install -r requirements.txt` and successful import of sphinx and sphinx_apidoc in Python.
- Symbolic link created successfully; `ls -l` in documentation directory shows link target (e.g., `tutorials -> ../tutorials`).
- sphinx-apidoc generates .rst files in the target directory; verify with `ls *.rst` and check file contents contain module docstring text.
- make html completes without errors; _build/html/index.html exists and is valid HTML; no build warnings about missing modules or broken references.
- Browser can open _build/html/index.html and navigate between API pages; docstrings are rendered with proper formatting and cross-links.

## Limitations

- Sphinx-apidoc only processes modules with docstrings; undocumented code produces minimal or empty stubs.
- Symbolic links may not work on all filesystems or operating systems (e.g., Windows without developer mode); alternative copy or path configuration may be required.
- Build time scales with module size and number of dependencies; very large packages may require incremental builds or parallel processing.
- API documentation is static at build time; dynamic or runtime-generated APIs are not captured by sphinx-apidoc.
- Cross-references between external packages require those packages to be installed or sphinx-inventory files to be available.

## Evidence

- [other] Install Python dependencies from requirements.txt using pip. Create a symbolic link from the tutorials folder to the current documentation directory using ln -s. Generate API documentation stubs by running sphinx-apidoc to scan the ../dreams module and output documentation source files. Build HTML documentation using make html, which processes Sphinx source files and generates the browsable output in _build/html/.: "Install Python dependencies from requirements.txt using pip. Create a symbolic link from the tutorials folder to the current documentation directory using ln -s. Generate API documentation stubs by"
- [methods] pip install -r requirements.txt: "pip install -r requirements.txt"
- [methods] sphinx-apidoc -o . ../dreams && make html: "sphinx-apidoc -o . ../dreams && make html"
- [methods] open _build/html/index.html: "open _build/html/index.html"
- [other] The documentation build mechanism invokes sphinx-apidoc to generate API stubs from the ../dreams source directory into the current directory, then executes make html to compile the Sphinx documentation into browsable HTML files in the _build/html output directory.: "The documentation build mechanism invokes sphinx-apidoc to generate API stubs from the ../dreams source directory into the current directory, then executes make html to compile the Sphinx"

