Building Documentation Locally๏
๐งฑ This guide walks you through building and previewing your project documentation using Sphinx โ the same way it will appear on Read the Docs.
This is useful for checking formatting, linking, and rendering before publishing.
๐ฆ Step 1: Install Documentation Dependencies๏
The required tools are listed in requirements-dev.txt. These are included because the project uses Sphinx-based documentation and may include Jupyter notebooks or Markdown-based pages.
To install them:
pip install -r requirements-dev.txt
This installs:
sphinxsphinx_rtd_thememyst-parserfor Markdown supportnumpydocfor parsing NumPy-style docstringsnbsphinxandnbconvertfor integrating Jupyter notebookspypandocfor converting between Markdown and reStructuredText formats
๐ Step 2: Build the Docs๏
From the root of your project (where docs/ lives), run:
cd docs
make html
This generates the documentation site in docs/_build/html/.
To preview:
open _build/html/index.html # or use your browser
๐ก On Windows, use
start _build/html/index.html
๐ Writing in Markdown or reStructuredText๏
You can write documentation pages in either:
.mdMarkdown (usingmyst-parser).rstreStructuredText (Sphinxโs default)
Markdown is supported for all new pages โ just list them in your index.rst using the .md extension.
๐ง Tips for Clean Docs๏
Keep filenames and headings consistent
Use relative links when referring to other files
Use backticks for inline code:
like_this()Add
.. toctree::blocks to structure your site
๐งช Rebuild After Changes๏
Sphinx doesnโt auto-rebuild on save, so re-run make html each time you:
Add or rename a
.mdor.rstfileEdit cross-references or links
Change docstrings if youโre auto-documenting code
๐งฐ The
make htmlcommand is defined in the projectโsdocs/Makefile. You can inspect or modify it if needed.๐ The
docs/_build/folder is ignored from version control via.gitignore.๐ผ Static files like images, logos, or custom CSS should go in
docs/source/_static. A defaultlogo.jpgis included there.โ๏ธ The
docs/source/conf.pycontrols your Sphinx build settings. Edit project metadata likeproject,author, andreleaseto match your repo.
๐ Learn More๏
These explain the syntax and tools supported when writing .md or .rst pages for your docs.
Summary Cheatsheet๏
Task |
Command |
|---|---|
Install dependencies |
|
Build the docs |
|
Preview locally |
|
โ Local docs previewing helps you spot problems early and polish your project site before publishing!