Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 9837f1d

Browse files
committed
build: update docs build
1 parent dc6d4f7 commit 9837f1d

File tree

4 files changed

+75
-11
lines changed

4 files changed

+75
-11
lines changed

.github/workflows/tests.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ jobs:
3333
run: python -m pip install nox
3434
- name: Build the documentation.
3535
run: nox -s docs
36+
docfx:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Set up Python
41+
uses: actions/setup-python@v5
42+
# Use python 3.10 for docs to match the version for the sphinx plugin
43+
# https://github.com/googleapis/synthtool/pull/1891
44+
with:
45+
python-version: "3.10"
46+
cache: 'pip'
47+
- name: Install nox.
48+
run: python -m pip install nox
49+
- name: Build the documentation.
50+
run: nox -s docfx
3651
mypy:
3752
strategy:
3853
matrix:

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
# The theme to use for HTML and HTML Help pages. See the documentation for
8787
# a list of builtin themes.
8888
#
89-
html_theme = "sphinx_rtd_theme"
89+
html_theme = "alabaster"
9090

9191
# Theme options are theme-specific and customize the look and feel of a theme
9292
# further. For a list of options available for each theme, see the

noxfile.py

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,9 @@ def snippetgen(session):
644644

645645
@nox.session(python="3.10")
646646
def docs(session):
647-
"""Build the docs."""
647+
"""Build the docs for this library."""
648+
649+
session.install("-e", ".")
648650

649651
session.install(
650652
# We need to pin to specific versions of the `sphinxcontrib-*` packages
@@ -657,21 +659,68 @@ def docs(session):
657659
"sphinxcontrib-qthelp==1.0.3",
658660
"sphinxcontrib-serializinghtml==1.1.5",
659661
"sphinx==4.5.0",
660-
"sphinx_rtd_theme",
662+
"alabaster",
663+
"recommonmark",
661664
)
662-
session.install(".")
663665

664-
# Build the docs!
665-
session.run("rm", "-rf", "docs/_build/")
666+
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
666667
session.run(
667668
"sphinx-build",
668-
"-W",
669+
"-W", # warnings as errors
670+
"-T", # show full traceback on exception
671+
"-N", # no colors
672+
"-b",
673+
"html",
674+
"-d",
675+
os.path.join("docs", "_build", "doctrees", ""),
676+
os.path.join("docs", ""),
677+
os.path.join("docs", "_build", "html", ""),
678+
)
679+
680+
681+
@nox.session(python="3.10")
682+
def docfx(session):
683+
"""Build the docfx yaml files for this library."""
684+
685+
session.install("-e", ".")
686+
session.install(
687+
# We need to pin to specific versions of the `sphinxcontrib-*` packages
688+
# which still support sphinx 4.x.
689+
# See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
690+
# and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
691+
"sphinxcontrib-applehelp==1.0.4",
692+
"sphinxcontrib-devhelp==1.0.2",
693+
"sphinxcontrib-htmlhelp==2.0.1",
694+
"sphinxcontrib-qthelp==1.0.3",
695+
"sphinxcontrib-serializinghtml==1.1.5",
696+
"gcp-sphinx-docfx-yaml",
697+
"alabaster",
698+
"recommonmark",
699+
)
700+
701+
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
702+
session.run(
703+
"sphinx-build",
704+
"-T", # show full traceback on exception
705+
"-N", # no colors
706+
"-D",
707+
(
708+
"extensions=sphinx.ext.autodoc,"
709+
"sphinx.ext.autosummary,"
710+
"docfx_yaml.extension,"
711+
"sphinx.ext.intersphinx,"
712+
"sphinx.ext.coverage,"
713+
"sphinx.ext.napoleon,"
714+
"sphinx.ext.todo,"
715+
"sphinx.ext.viewcode,"
716+
"recommonmark"
717+
),
669718
"-b",
670719
"html",
671720
"-d",
672-
"docs/_build/doctrees",
673-
"docs/",
674-
"docs/_build/html/",
721+
os.path.join("docs", "_build", "doctrees", ""),
722+
os.path.join("docs", ""),
723+
os.path.join("docs", "_build", "html", ""),
675724
)
676725

677726

owlbot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
templated_files = CommonTemplates().py_library()
1919
s.move(
2020
templated_files / ".kokoro",
21-
excludes=["samples/**/*", "test-samples*", "publish-docs.sh", "*/prerelease-deps.cfg"],
21+
excludes=["samples/**/*", "test-samples*", "*/prerelease-deps.cfg"],
2222
)
2323

2424
# needed for docs build

0 commit comments

Comments
 (0)