|
17 | 17 | from __future__ import absolute_import |
18 | 18 |
|
19 | 19 | import configparser |
20 | | -import nox |
21 | 20 | import os |
| 21 | +import shutil |
| 22 | + |
| 23 | +import nox |
22 | 24 |
|
23 | 25 | ALEMBIC_CONF = """ |
24 | 26 | [alembic] |
@@ -407,6 +409,87 @@ def prerelease_deps(session): |
407 | 409 | session.skip("prerelease deps tests are not yet supported") |
408 | 410 |
|
409 | 411 |
|
| 412 | +@nox.session(python="3.10") |
| 413 | +def docs(session): |
| 414 | + """Build the docs for this library.""" |
| 415 | + |
| 416 | + session.install("-e", ".") |
| 417 | + session.install( |
| 418 | + # We need to pin to specific versions of the `sphinxcontrib-*` packages |
| 419 | + # which still support sphinx 4.x. |
| 420 | + # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344 |
| 421 | + # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345. |
| 422 | + "sphinxcontrib-applehelp==1.0.4", |
| 423 | + "sphinxcontrib-devhelp==1.0.2", |
| 424 | + "sphinxcontrib-htmlhelp==2.0.1", |
| 425 | + "sphinxcontrib-qthelp==1.0.3", |
| 426 | + "sphinxcontrib-serializinghtml==1.1.5", |
| 427 | + "sphinx==4.5.0", |
| 428 | + "alabaster", |
| 429 | + "recommonmark", |
| 430 | + ) |
| 431 | + |
| 432 | + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) |
| 433 | + session.run( |
| 434 | + "sphinx-build", |
| 435 | + "-W", # warnings as errors |
| 436 | + "-T", # show full traceback on exception |
| 437 | + "-N", # no colors |
| 438 | + "-b", |
| 439 | + "html", |
| 440 | + "-d", |
| 441 | + os.path.join("docs", "_build", "doctrees", ""), |
| 442 | + os.path.join("docs", ""), |
| 443 | + os.path.join("docs", "_build", "html", ""), |
| 444 | + ) |
| 445 | + |
| 446 | + |
| 447 | +@nox.session(python="3.10") |
| 448 | +def docfx(session): |
| 449 | + """Build the docfx yaml files for this library.""" |
| 450 | + |
| 451 | + session.install("-e", ".") |
| 452 | + session.install( |
| 453 | + # We need to pin to specific versions of the `sphinxcontrib-*` packages |
| 454 | + # which still support sphinx 4.x. |
| 455 | + # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344 |
| 456 | + # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345. |
| 457 | + "sphinxcontrib-applehelp==1.0.4", |
| 458 | + "sphinxcontrib-devhelp==1.0.2", |
| 459 | + "sphinxcontrib-htmlhelp==2.0.1", |
| 460 | + "sphinxcontrib-qthelp==1.0.3", |
| 461 | + "sphinxcontrib-serializinghtml==1.1.5", |
| 462 | + "gcp-sphinx-docfx-yaml", |
| 463 | + "alabaster", |
| 464 | + "recommonmark", |
| 465 | + ) |
| 466 | + |
| 467 | + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) |
| 468 | + session.run( |
| 469 | + "sphinx-build", |
| 470 | + "-T", # show full traceback on exception |
| 471 | + "-N", # no colors |
| 472 | + "-D", |
| 473 | + ( |
| 474 | + "extensions=sphinx.ext.autodoc," |
| 475 | + "sphinx.ext.autosummary," |
| 476 | + "docfx_yaml.extension," |
| 477 | + "sphinx.ext.intersphinx," |
| 478 | + "sphinx.ext.coverage," |
| 479 | + "sphinx.ext.napoleon," |
| 480 | + "sphinx.ext.todo," |
| 481 | + "sphinx.ext.viewcode," |
| 482 | + "recommonmark" |
| 483 | + ), |
| 484 | + "-b", |
| 485 | + "html", |
| 486 | + "-d", |
| 487 | + os.path.join("docs", "_build", "doctrees", ""), |
| 488 | + os.path.join("docs", ""), |
| 489 | + os.path.join("docs", "_build", "html", ""), |
| 490 | + ) |
| 491 | + |
| 492 | + |
410 | 493 | @nox.session |
411 | 494 | def format(session: nox.sessions.Session) -> None: |
412 | 495 | session.install(BLACK_VERSION, ISORT_VERSION) |
|
0 commit comments