Skip to content

Commit 94a5669

Browse files
authored
Merge pull request #369 from dbatten5/add-docs-nox-session
Add `docs` session
2 parents e9ff8b9 + 86bf770 commit 94a5669

File tree

3 files changed

+315
-0
lines changed

3 files changed

+315
-0
lines changed

noxfile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,22 @@ def docs_build(session: Session) -> None:
173173
session.run("sphinx-build", "-b", "html", "docs", str(docs_build_dir), "-W")
174174

175175

176+
@nox.session(python=DEFAULT_PYTHON_VERSION, name="docs", tags=[DOCS, BUILD])
177+
def docs(session: Session) -> None:
178+
"""Build the project documentation (Sphinx)."""
179+
session.log("Installing documentation dependencies...")
180+
session.install("-e", ".", "--group", "docs")
181+
182+
session.log(f"Building documentation with py{session.python}.")
183+
docs_build_dir = Path("docs") / "_build" / "html"
184+
185+
session.log(f"Cleaning build directory: {docs_build_dir}")
186+
session.run("sphinx-build", "-b", "html", "docs", str(docs_build_dir), "-E")
187+
188+
session.log("Building and serving documentation.")
189+
session.run("sphinx-autobuild", "--open-browser", "docs", str(docs_build_dir))
190+
191+
176192
@nox.session(python=False, name="build-python", tags=[BUILD, PYTHON])
177193
def build_python(session: Session) -> None:
178194
"""Build sdist and wheel packages (uv build)."""

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ docs = [
4141
"furo>=2024.8.6",
4242
"myst-parser>=3.0.1",
4343
"sphinx>=7.4.7",
44+
"sphinx-autobuild>=2024.10.3",
4445
"sphinx-autodoc-typehints>=2.3.0",
4546
"sphinx-copybutton>=0.5.2",
4647
"sphinx-tabs>=3.4.7",

0 commit comments

Comments
 (0)