@@ -630,7 +630,9 @@ def snippetgen(session):
630
630
631
631
@nox .session (python = "3.10" )
632
632
def docs (session ):
633
- """Build the docs."""
633
+ """Build the docs for this generator."""
634
+
635
+ session .install ("-e" , "." )
634
636
635
637
session .install (
636
638
# We need to pin to specific versions of the `sphinxcontrib-*` packages
@@ -643,21 +645,68 @@ def docs(session):
643
645
"sphinxcontrib-qthelp==1.0.3" ,
644
646
"sphinxcontrib-serializinghtml==1.1.5" ,
645
647
"sphinx==4.5.0" ,
646
- "sphinx_rtd_theme" ,
648
+ "sphinx-rtd-theme" ,
649
+ )
650
+
651
+ shutil .rmtree (os .path .join ("docs" , "_build" ), ignore_errors = True )
652
+ session .run (
653
+ "sphinx-build" ,
654
+ "-W" , # warnings as errors
655
+ "-T" , # show full traceback on exception
656
+ "-N" , # no colors
657
+ "-b" ,
658
+ "html" , # builder
659
+ "-d" ,
660
+ os .path .join ("docs" , "_build" , "doctrees" , "" ), # cache directory
661
+ # paths to build:
662
+ os .path .join ("docs" , "" ),
663
+ os .path .join ("docs" , "_build" , "html" , "" ),
664
+ )
665
+
666
+
667
+ @nox .session (python = "3.10" )
668
+ def docfx (session ):
669
+ """Build the docfx yaml files for this library."""
670
+
671
+ session .install ("-e" , "." )
672
+ session .install (
673
+ # We need to pin to specific versions of the `sphinxcontrib-*` packages
674
+ # which still support sphinx 4.x.
675
+ # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
676
+ # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
677
+ "sphinxcontrib-applehelp==1.0.4" ,
678
+ "sphinxcontrib-devhelp==1.0.2" ,
679
+ "sphinxcontrib-htmlhelp==2.0.1" ,
680
+ "sphinxcontrib-qthelp==1.0.3" ,
681
+ "sphinxcontrib-serializinghtml==1.1.5" ,
682
+ "gcp-sphinx-docfx-yaml" ,
683
+ "sphinx-rtd-theme" ,
647
684
)
648
- session .install ("." )
649
685
650
- # Build the docs!
651
- session .run ("rm" , "-rf" , "docs/_build/" )
686
+ shutil .rmtree (os .path .join ("docs" , "_build" ), ignore_errors = True )
652
687
session .run (
653
688
"sphinx-build" ,
654
- "-W" ,
689
+ "-T" , # show full traceback on exception
690
+ "-N" , # no colors
691
+ "-D" , # Override configuration values set in the conf.py file
692
+ (
693
+ "extensions=sphinx.ext.autodoc,"
694
+ "sphinx.ext.autosummary,"
695
+ "docfx_yaml.extension,"
696
+ "sphinx.ext.intersphinx,"
697
+ "sphinx.ext.coverage,"
698
+ "sphinx.ext.napoleon,"
699
+ "sphinx.ext.todo,"
700
+ "sphinx.ext.viewcode,"
701
+ "recommonmark"
702
+ ),
655
703
"-b" ,
656
- "html" ,
704
+ "html" , # builder
657
705
"-d" ,
658
- "docs/_build/doctrees" ,
659
- "docs/" ,
660
- "docs/_build/html/" ,
706
+ os .path .join ("docs" , "_build" , "doctrees" , "" ), # cache directory
707
+ # paths to build:
708
+ os .path .join ("docs" , "" ),
709
+ os .path .join ("docs" , "_build" , "html" , "" ),
661
710
)
662
711
663
712
0 commit comments