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. Checkout 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 checkout 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 "sphinx>=4.0" pillow
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
$ pip install -r requirements.txt -r dev-requirements.txt
$ conda install graphviz # if using conda, you can get graphviz this way
$ pip install -e .
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.16.0.tar.gz
.
File metadata
- Download URL: sphinx_gallery-0.16.0.tar.gz
- Upload date:
- Size: 432.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3912765bc5e7b5451dc471ad50ead808a9752280b23fd2ec4277719a5ef68e42 |
|
MD5 | 5468a23a277e6f1716c7899a39cfa758 |
|
BLAKE2b-256 | b6c232ce2530a8d287e33c4aff911a3ac0e239ac94c89dfd9ef9215c78e13ea9 |
Provenance
File details
Details for the file sphinx_gallery-0.16.0-py3-none-any.whl
.
File metadata
- Download URL: sphinx_gallery-0.16.0-py3-none-any.whl
- Upload date:
- Size: 413.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5456514f4efb230a6f1db6241667774ca3ee8f15e9a7456678f1d1815118e60 |
|
MD5 | 6aeb8e675cf8e53dae83b487e902aaa4 |
|
BLAKE2b-256 | 2d7a64d176f78baaed269ae809e9386710064feedf3723ba910ef247530ea3d8 |