@@ -183,25 +183,28 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
183183
184184
185185sphinx_gallery_conf = {
186+ 'backreferences_dir' :Path ('api' )/ Path ('_as_gen' ),
187+ # Compression is a significant effort that we skip for local and CI builds.
188+ 'compress_images' : ('thumbnails' ,'images' )if is_release_build else (),
189+ 'doc_module' : ('matplotlib' ,'mpl_toolkits' ),
186190'examples_dirs' : ['../examples' ,'../tutorials' ,'../plot_types' ],
187191'filename_pattern' :'^((?!sgskip).)*$' ,
188192'gallery_dirs' : ['gallery' ,'tutorials' ,'plot_types' ],
189- 'doc_module' : ('matplotlib' ,'mpl_toolkits' ),
190- 'reference_url' : {
191- 'matplotlib' :None ,
192- },
193- 'backreferences_dir' :Path ('api' )/ Path ('_as_gen' ),
194- 'subsection_order' :gallery_order .sectionorder ,
195- 'within_subsection_order' :gallery_order .subsectionorder ,
196- 'remove_config_comments' :True ,
197- 'min_reported_time' :1 ,
198- 'thumbnail_size' : (320 ,224 ),
199193'image_scrapers' : (matplotlib_reduced_latex_scraper , ),
200- # Compression is a significant effort that we skip for local and CI builds.
201- 'compress_images' : ('thumbnails' ,'images' )if is_release_build else (),
202- 'matplotlib_animations' :True ,
203194'image_srcset' : ["2x" ],
204195'junit' :'../test-results/sphinx-gallery/junit.xml' if CIRCLECI else '' ,
196+ 'matplotlib_animations' :True ,
197+ 'min_reported_time' :1 ,
198+ 'reference_url' : {'matplotlib' :None },
199+ 'remove_config_comments' :True ,
200+ 'reset_modules' : (
201+ 'matplotlib' ,
202+ # clear basic_units module to re-register with unit registry on import
203+ lambda gallery_conf ,fname :sys .modules .pop ('basic_units' ,None )
204+ ),
205+ 'subsection_order' :gallery_order .sectionorder ,
206+ 'thumbnail_size' : (320 ,224 ),
207+ 'within_subsection_order' :gallery_order .subsectionorder ,
205208}
206209
207210mathmpl_fontsize = 11.0