Skip to main content
Ctrl+K

🖼️ Sphinx-Gallery

  • User guide
  • Advanced
  • Demo galleries
  • Contribution Guide
  • Changelog
  • GitHub
  • PyPI
  • User guide
  • Advanced
  • Demo galleries
  • Contribution Guide
  • Changelog
  • GitHub
  • PyPI

Section Navigation

  • Advanced usage
  • Frequently Asked Questions
  • Sphinx-Gallery Utilities
  • Sphinx-Gallery API Reference
    • sphinx_gallery.gen_gallery
    • sphinx_gallery.backreferences
    • sphinx_gallery.gen_rst
    • sphinx_gallery.scrapers
    • sphinx_gallery.py_source_parser
    • sphinx_gallery.block_parser
    • sphinx_gallery.docs_resolv
    • sphinx_gallery.notebook
    • sphinx_gallery.downloads
    • sphinx_gallery.sorting
    • sphinx_gallery.interactive_example
    • sphinx_gallery.directives
    • sphinx_gallery.utils.optipng
  • Advanced topics
  • Sphinx-Gallery Utilities

Sphinx-Gallery Utilities#

Convert Python scripts into Jupyter Notebooks#

Sphinx Gallery exposes its python source to Jupyter notebook converter as a executable script too. To use this utility just call the script and give the Python source file as argument:

$ python -m sphinx_gallery_py2jupyter python_script.py

Embedding Sphinx-Gallery inside your documentation script extensions#

If you want to embed Sphinx-Gallery in your project instead of putting it as a dependency you can call our embedding script inside your Sphinx extensions folder:

# Script to do a local install of sphinx-gallery
rm -rf tmp sphinx_gallery

easy_install -Zeab tmp sphinx-gallery

cp -vru tmp/sphinx-gallery/sphinx_gallery/ .

echo "Remember to add sphinx_gallery to your version control"
echo "Use in case of git:"
echo "$ git add sphinx_gallery"

This will download directly from PyPI our latest released code and save it to the current folder. This is a stripped version of the Sphinx-Gallery module to incorporate in your project. You should also add it to your version control system.

Minigallery directive#

Sphinx-Gallery provides the minigallery directive so you can easily add a reduced version of the gallery to your documentation. See Add mini-galleries for details.

previous

Frequently Asked Questions

next

Sphinx-Gallery API Reference

On this page
  • Convert Python scripts into Jupyter Notebooks
  • Embedding Sphinx-Gallery inside your documentation script extensions
  • Minigallery directive

© Copyright 2014-2025, Sphinx-gallery developers.

Created using Sphinx 8.1.3.

Built with the PyData Sphinx Theme 0.16.1.