Skip to content

Commit 8fb857d

Browse files
committed
fix(nox): add missing docs and docfx sessions
These missing sessions were causing CI pipeline failures. Restored them utilizing the standard monorepo document generation templates.
1 parent 03cce70 commit 8fb857d

File tree

1 file changed

+84
-1
lines changed

1 file changed

+84
-1
lines changed

packages/sqlalchemy-spanner/noxfile.py

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
from __future__ import absolute_import
1818

1919
import configparser
20-
import nox
2120
import os
21+
import shutil
22+
23+
import nox
2224

2325
ALEMBIC_CONF = """
2426
[alembic]
@@ -407,6 +409,87 @@ def prerelease_deps(session):
407409
session.skip("prerelease deps tests are not yet supported")
408410

409411

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+
410493
@nox.session
411494
def format(session: nox.sessions.Session) -> None:
412495
session.install(BLACK_VERSION, ISORT_VERSION)

0 commit comments

Comments
 (0)