2323import time
2424
2525# Release mode enables optimizations and other related options.
26- _doc_release_mode = tags .has ('release' ) # noqa
26+ is_release_build = tags .has ('release' ) # noqa
2727
2828# are we running circle CI?
2929CIRCLECI = 'CIRCLECI' in os .environ
@@ -179,7 +179,8 @@ def _check_dependencies():
179179 'remove_config_comments' : True ,
180180 'min_reported_time' : 1 ,
181181 'thumbnail_size' : (320 , 224 ),
182- 'compress_images' : ('thumbnails' , 'images' ) if _doc_release_mode else (),
182+ # Compression is a significant effort that we skip for local and CI builds.
183+ 'compress_images' : ('thumbnails' , 'images' ) if is_release_build else (),
183184 'matplotlib_animations' : True ,
184185 'image_srcset' : ["2x" ],
185186 'junit' : '../test-results/sphinx-gallery/junit.xml' if CIRCLECI else '' ,
@@ -296,7 +297,9 @@ def _check_dependencies():
296297html_logo = "_static/logo2.svg"
297298html_theme_options = {
298299 "logo_link" : "index" ,
299- "collapse_navigation" : not _doc_release_mode ,
300+ # collapse_navigation in pydata-sphinx-theme is slow, so skipped for local
301+ # and CI builds https://github.com/pydata/pydata-sphinx-theme/pull/386
302+ "collapse_navigation" : not is_release_build ,
300303 "icon_links" : [
301304 {
302305 "name" : "gitter" ,
@@ -322,7 +325,7 @@ def _check_dependencies():
322325 "show_prev_next" : False ,
323326 "navbar_center" : ["mpl_nav_bar.html" ],
324327}
325- include_analytics = _doc_release_mode
328+ include_analytics = is_release_build
326329if include_analytics :
327330 html_theme_options ["google_analytics_id" ] = "UA-55954603-1"
328331
@@ -542,6 +545,8 @@ def _check_dependencies():
542545
543546
544547def reduce_plot_formats (app ):
548+ # Fox CI and local builds, we don't need all the default plot formats, so
549+ # only generate the directly useful one for the current builder.
545550 if app .builder .name == 'html' :
546551 keep = 'png'
547552 elif app .builder .name == 'latex' :
@@ -560,7 +565,7 @@ def setup(app):
560565 bld_type = 'rel'
561566 app .add_config_value ('releaselevel' , bld_type , 'env' )
562567
563- if not _doc_release_mode :
568+ if not is_release_build :
564569 app .connect ('builder-inited' , reduce_plot_formats )
565570
566571# -----------------------------------------------------------------------------
0 commit comments