Skip to content

Commit 83b21a4

Browse files
committed
Sphinx-Gallery has to be loaded after autodoc
Sphinx loads its extensions sequentially as they are specified on the list. Sphinx-Gallery relies en autodoc to generated the example thumbnails when auto documenting the API. If autodoc is not loaded sphinx-gallery skips this step, as it implies the user might not want it. In this case we need it, so the gallery has to be loaded after autodoc and autosummary. The autosummary_generate variable is repeated
1 parent 4773dbb commit 83b21a4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

doc/conf.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@
3030

3131
# Add any Sphinx extension module names here, as strings. They can be
3232
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
33-
extensions = ['sphinx_gallery.gen_gallery',
34-
'sphinx.ext.autodoc', 'sphinx.ext.autosummary',
35-
'sphinx.ext.pngmath', 'numpy_ext.numpydoc',
36-
'sphinx.ext.linkcode', 'sphinx.ext.doctest',
37-
]
38-
39-
autosummary_generate = True
33+
extensions = [
34+
'sphinx.ext.autodoc', 'sphinx.ext.autosummary',
35+
'sphinx.ext.pngmath', 'numpy_ext.numpydoc',
36+
'sphinx.ext.linkcode', 'sphinx.ext.doctest',
37+
'sphinx_gallery.gen_gallery',
38+
]
4039

4140
autodoc_default_flags = ['members', 'inherited-members']
4241

@@ -227,13 +226,13 @@
227226

228227
sphinx_gallery_conf = {
229228
'doc_module': 'sklearn',
230-
'reference_url' : {
229+
'reference_url': {
231230
'sklearn': None,
232231
'matplotlib': 'http://matplotlib.org',
233232
'numpy': 'http://docs.scipy.org/doc/numpy-1.6.0',
234233
'scipy': 'http://docs.scipy.org/doc/scipy-0.11.0/reference',
235234
'nibabel': 'http://nipy.org/nibabel'}
236-
}
235+
}
237236

238237

239238
# The following dictionary contains the information used to create the
@@ -246,6 +245,7 @@
246245
'sphx_glr_plot_adaboost_twoclass_001.png': 372,
247246
'sphx_glr_plot_compare_methods_001.png': 349}
248247

248+
249249
def make_carousel_thumbs(app, exception):
250250
"""produces the final resized carousel images"""
251251
if exception is not None:
@@ -256,7 +256,7 @@ def make_carousel_thumbs(app, exception):
256256
for glr_plot, max_width in carousel_thumbs.items():
257257
image = os.path.join(image_dir, glr_plot)
258258
if os.path.exists(image):
259-
c_thumb = os.path.join(image_dir, glr_plot[:-4]+'_carousel.png')
259+
c_thumb = os.path.join(image_dir, glr_plot[:-4] + '_carousel.png')
260260
sphinx_gallery.gen_rst.scale_image(image, c_thumb, max_width, 190)
261261

262262

0 commit comments

Comments
 (0)