A Sphinx extension that builds an HTML gallery of examples from any set of Python scripts.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sphinx_gallery-0.17.0.tar.gz
.
File metadata
- Download URL: sphinx_gallery-0.17.0.tar.gz
- Upload date:
- Size: 461.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cae4eb8317c7a316813e3ffdc13f92bcb932a54c360c07a94b60fced74a9fd3f |
|
MD5 | 98b782ff7fbcb01d9a661b68b815e24f |
|
BLAKE2b-256 | c78c45cf5c639fcafeb81cb7afbf922a77aa683776215e40013d2e7d37dcec99 |
Provenance
File details
Details for the file sphinx_gallery-0.17.0-py3-none-any.whl
.
File metadata
- Download URL: sphinx_gallery-0.17.0-py3-none-any.whl
- Upload date:
- Size: 443.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 245c02d5cd156d568e978a562091c871255affe41f1a52e9b9eb5023f891cdb9 |
|
MD5 | 5d7c02d78d7ef2ca98d87c29244cf97b |
|
BLAKE2b-256 | a0c195252f82a6e6560b6ac74f470e0ef829b69e726ca6b241595145792e6846 |