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-galleryVerified import paths — ran on the pinned version, not inferred.
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`.
Upgrade your Python environment to version 3.10 or newer. If you need Python 3.8 support, use sphinx-gallery<0.20.0.
Ensure your environment uses Python 3.9+ and Sphinx 5+. If upgrading Sphinx is not an option, use sphinx-gallery<0.17.0.
Update your `conf.py` to pass string references for these configuration options instead of direct callable objects.
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.