23
23
import time
24
24
25
25
# Release mode enables optimizations and other related options.
26
- _doc_release_mode = tags .has ('release' ) # noqa
26
+ is_release_build = tags .has ('release' ) # noqa
27
27
28
28
# are we running circle CI?
29
29
CIRCLECI = 'CIRCLECI' in os .environ
@@ -179,7 +179,8 @@ def _check_dependencies():
179
179
'remove_config_comments' : True ,
180
180
'min_reported_time' : 1 ,
181
181
'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 (),
183
184
'matplotlib_animations' : True ,
184
185
'image_srcset' : ["2x" ],
185
186
'junit' : '../test-results/sphinx-gallery/junit.xml' if CIRCLECI else '' ,
@@ -296,7 +297,9 @@ def _check_dependencies():
296
297
html_logo = "_static/logo2.svg"
297
298
html_theme_options = {
298
299
"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 ,
300
303
"icon_links" : [
301
304
{
302
305
"name" : "gitter" ,
@@ -322,7 +325,7 @@ def _check_dependencies():
322
325
"show_prev_next" : False ,
323
326
"navbar_center" : ["mpl_nav_bar.html" ],
324
327
}
325
- include_analytics = _doc_release_mode
328
+ include_analytics = is_release_build
326
329
if include_analytics :
327
330
html_theme_options ["google_analytics_id" ] = "UA-55954603-1"
328
331
@@ -542,6 +545,8 @@ def _check_dependencies():
542
545
543
546
544
547
def 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.
545
550
if app .builder .name == 'html' :
546
551
keep = 'png'
547
552
elif app .builder .name == 'latex' :
@@ -560,7 +565,7 @@ def setup(app):
560
565
bld_type = 'rel'
561
566
app .add_config_value ('releaselevel' , bld_type , 'env' )
562
567
563
- if not _doc_release_mode :
568
+ if not is_release_build :
564
569
app .connect ('builder-inited' , reduce_plot_formats )
565
570
566
571
# -----------------------------------------------------------------------------
0 commit comments