@@ -644,7 +644,9 @@ def snippetgen(session):
644644
645645@nox .session (python = "3.10" )
646646def 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
0 commit comments