|
14 | 14 |
|
15 | 15 | from __future__ import absolute_import |
16 | 16 |
|
| 17 | +import shutil |
17 | 18 | import nox |
| 19 | +import os |
18 | 20 | import pathlib |
19 | 21 |
|
20 | 22 |
|
@@ -243,6 +245,53 @@ def docs(session): |
243 | 245 | ) |
244 | 246 |
|
245 | 247 |
|
| 248 | +@nox.session(python="3.10") |
| 249 | +def docfx(session): |
| 250 | + """Build the docfx yaml files for this library.""" |
| 251 | + |
| 252 | + session.install("-e", ".") |
| 253 | + session.install( |
| 254 | + # We need to pin to specific versions of the `sphinxcontrib-*` packages |
| 255 | + # which still support sphinx 4.x. |
| 256 | + # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344 |
| 257 | + # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345. |
| 258 | + "sphinxcontrib-applehelp==1.0.4", |
| 259 | + "sphinxcontrib-devhelp==1.0.2", |
| 260 | + "sphinxcontrib-htmlhelp==2.0.1", |
| 261 | + "sphinxcontrib-qthelp==1.0.3", |
| 262 | + "sphinxcontrib-serializinghtml==1.1.5", |
| 263 | + "gcp-sphinx-docfx-yaml", |
| 264 | + "alabaster", |
| 265 | + "recommonmark", |
| 266 | + "sphinx_rtd_theme", |
| 267 | + ) |
| 268 | + |
| 269 | + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) |
| 270 | + session.run( |
| 271 | + "sphinx-build", |
| 272 | + "-T", # show full traceback on exception |
| 273 | + "-N", # no colors |
| 274 | + "-D", |
| 275 | + ( |
| 276 | + "extensions=sphinx.ext.autodoc," |
| 277 | + "sphinx.ext.autosummary," |
| 278 | + "docfx_yaml.extension," |
| 279 | + "sphinx.ext.intersphinx," |
| 280 | + "sphinx.ext.coverage," |
| 281 | + "sphinx.ext.napoleon," |
| 282 | + "sphinx.ext.todo," |
| 283 | + "sphinx.ext.viewcode," |
| 284 | + "recommonmark" |
| 285 | + ), |
| 286 | + "-b", |
| 287 | + "html", |
| 288 | + "-d", |
| 289 | + os.path.join("docs", "_build", "doctrees", ""), |
| 290 | + os.path.join("docs", ""), |
| 291 | + os.path.join("docs", "_build", "html", ""), |
| 292 | + ) |
| 293 | + |
| 294 | + |
246 | 295 | @nox.session(python=DEFAULT_PYTHON_VERSION) |
247 | 296 | def lint_setup_py(session): |
248 | 297 | """Verify that setup.py is valid (including RST check).""" |
|
0 commit comments