Sphinx-Gallery
A Sphinx extension that builds an HTML gallery of examples from any set of Python scripts. Check out the documentation for introductions on how to use it and more…
Quickstart
Sphinx-Gallery can be used to generate an example gallery from .py files, for a library, as well as a stand-alone web page showcasing examples of a particular Python package, module, or class.
- Let’s get started with a simple example or check out the
documentation for introductions on how to use it and more…
Install via pip
You can do a direct install via pip by using:
$ pip install sphinx-gallery
Add examples to your docs
Let’s assume simple scenario, you have a Python package with a directory structure like this:
├── doc
│ ├── conf.py
│ ├── index.rst
| ├── make.bat
│ └── Makefile
├── my_python_module
│ ├── __init__.py
│ └── mod.py
└── examples
├── plot_example.py
└── README.txt (or .rst)
Enable Sphinx-Gallery by adding the following to your doc/conf.py:
extensions = [
...
'sphinx_gallery.gen_gallery',
]
# path to the examples scripts
sphinx_gallery_conf = {
'examples_dirs': '../examples', # path to your example scripts
'gallery_dirs': 'auto_examples', # path to where to save gallery generated output
}
Finally just compile your docs as usual. Sphinx-Gallery will generate reST files, adding execution outputs, and save them in auto_examples/. Add a link to auto_examples/index.rst to include the gallery in your documentation.
Who uses Sphinx-Gallery
An incomplete list:
Contributing
You can get the latest development source from our Github repository. You need setuptools installed in your system to install Sphinx-Gallery. For example, you can do:
$ git clone https://github.com/sphinx-gallery/sphinx-gallery
$ cd sphinx-gallery
$ conda install graphviz # if using conda, you can get graphviz this way
$ pip install -e .[dev]
Check that you are all set by running:
$ pytest sphinx_gallery
How to cite
If you would like to cite Sphinx-Gallery you can do so using our Zenodo deposit.
Release files for sphinx-gallery 0.22.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sphinx_gallery-0.22.0.tar.gz | 505.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sphinx_gallery-0.22.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 990.0 kB
Release files / sphinx_gallery-0.22.0.tar.gz
| Download URL | sphinx_gallery-0.22.0.tar.gz |
|---|---|
| Size | 505.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03392d30e3a561b493e728c776799238b484c1648b2ed1a04182831ae8d7d7ce
|
|
BLAKE2b-256 checksum How to use checksums |
039abbc84c497f90b599747ebbcb28e5943fb3d542b112597985000fae730112
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency logRelease files / sphinx_gallery-0.22.0-py3-none-any.whl
| Download URL | sphinx_gallery-0.22.0-py3-none-any.whl |
|---|---|
| Size | 484.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2adea49f00b5a5a65f4a0141bb6a5bd0b9c2f0e76ca1483477424e2295584ad4
|
|
BLAKE2b-256 checksum How to use checksums |
ccaffded01d0cd0f050eb8d5ac68859a6f02daf782a57c3d98b84dde59bbfdf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency log