Use this prompt to replicate the documentation system used in this project for other Python libraries.
Task: Set up a professional documentation system using Sphinx, Furo theme, and Jupyter Notebook integration.
Context: The project is a Python library that needs high-quality documentation including API reference, user guide, and executable examples from Jupyter notebooks.
Requirements:
-
Dependencies:
- Add a
docsdependency group inpyproject.toml(orrequirements-docs.txt) with the following packages:sphinx>=8.0 nbsphinx>=0.9.7 nbsphinx-link furo ipykernel sphinx-rtd-theme>=3.0.2 # (Optional fallback or specific components) sphinxcontrib-bibtex>=2.6.5
- Add a
-
Configuration (
conf.py):- Set
html_theme = "furo". - enable extensions:
extensions = [ "nbsphinx", "nbsphinx_link", "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.intersphinx", "sphinx.ext.mathjax", "sphinx.ext.napoleon", "sphinx.ext.viewcode", "sphinxcontrib.bibtex", ]
- Configure
nbsphinxto not execute notebooks during build (unless desired):nbsphinx_execute = 'never' nbsphinx_allow_errors = True
- Configure
bibtexif references are needed.
- Set
-
Folder Structure:
docs/: Root documentation folder.docs/examples/: Place.nblinkfiles here to link to notebooks in the project root or examples directory.docs/_static/: Custom CSS/JS.docs/api/: API reference stubs.docs/user_guide/: Narrative documentation.
-
Notebook Integration:
- Use
nbsphinx-linkto include notebooks from outside thedocsdirectory without copying them. Create.nblinkfiles indocs/examples/like:{ "path": "../../examples/my_notebook.ipynb" }
- Use
-
Build Automation:
- Ensure
make html(via Makefile) works effectively. - Use
uv, run withuv run --group docs make -C docs html.
- Ensure
Output:
- A fully functional
docs/directory with configuredconf.py. - Updated
pyproject.tomlwith necessary dependencies. - Successful build of HTML documentation.