Registry / web-framework / sphinx-gallery

sphinx-gallery

JSON →
library0.21.0pypypi✓ verified 21d ago

Sphinx-Gallery is a Sphinx extension that automatically generates an HTML gallery of examples from any set of Python scripts. It converts `.py` files into reStructuredText, Jupyter notebooks, and includes features like thumbnail generation and API back-references. It is actively maintained with frequent releases, currently at version 0.20.0.

pip install sphinx-gallery
INSTALL
IMPORT
SIG · SPHINX-GALLERY
S
sphinx-gallery
web-frameworkpythonv0.21.0
Install
6.1s avg
Import
Disk
116MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.21.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 113.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 6.1s · import 0.000s · 115MB
116MB installed
● package 116MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sphinx_gallery.gen_gallery
extensions = ['sphinx_gallery.gen_gallery']
Sphinx-Gallery is typically enabled by adding its module path to the 'extensions' list in Sphinx's `conf.py` file, rather than importing specific symbols for direct use within `conf.py`.

To integrate Sphinx-Gallery, first enable it by adding `'sphinx_gallery.gen_gallery'` to the `extensions` list in your Sphinx `conf.py` file. Then, define the `sphinx_gallery_conf` dictionary to specify the input directory for your example scripts (`examples_dirs`) and the output directory for the generated gallery (`gallery_dirs`). The paths should be relative to `conf.py`.

import os # conf.py example extensions = [ # ... other extensions 'sphinx_gallery.gen_gallery', ] # Path to the directory containing example scripts, relative to conf.py examples_dir = os.path.join(os.path.dirname(__file__), '../examples') # Path to where Sphinx-Gallery should save its generated output, relative to conf.py gallery_dir = 'auto_examples' sphinx_gallery_conf = { 'examples_dirs': examples_dir, 'gallery_dirs': gallery_dir, 'plot_gallery': 'True', # Set to False to disable example execution 'backreferences_dir': 'gen_modules/backreferences' # For mini-galleries }
Debug
Known issues
breakingSupport for Python 3.8 has been dropped. Sphinx-Gallery now requires Python >=3.10.
fix
Upgrade your Python environment to version 3.10 or newer. If you need Python 3.8 support, use sphinx-gallery<0.20.0.
affects: >=0.20.0
breakingSupport for Python 3.8 and Sphinx 4 has been dropped. Sphinx-Gallery now requires Python >=3.9 and Sphinx >=5.
fix
Ensure your environment uses Python 3.9+ and Sphinx 5+. If upgrading Sphinx is not an option, use sphinx-gallery<0.17.0.
affects: >=0.17.0
breakingDue to Sphinx 7.3.0+ caching changes, certain `sphinx_gallery_conf` options that accept callables (e.g., `reset_argv`, `FileNameSortKey`, `notebook_modification_function`) must now be provided as fully qualified name *strings* (e.g., `'path.to.my_function'`) instead of instantiated classes or direct callables. Passing objects with unstable `__repr__` can force unnecessary rebuilds.
fix
Update your `conf.py` to pass string references for these configuration options instead of direct callable objects.
affects: >=0.16.0
breakingSupport for Python 3.7 was dropped. Additionally, `Pillow` was added as a required dependency.
fix
Upgrade your Python environment to 3.8 or newer. Ensure `Pillow` is installed (`pip install Pillow`). If you need Python 3.7, use sphinx-gallery<0.15.0.
affects: >=0.15.0
Upgrade
Version history
0.21.0latest on PyPI · released Apr 24, 2026
Audit
Dependencies
PillowrequiredAdded as a dependency in v0.15.0 for image processing; essential for thumbnail generation and image scraping.
Agent activity
14 hits · last 30 days
node
12
Resources
sphinx-gallery — pip install sphinx-gallery · libregistry