Introduction
MyST Sphinx Gallery is a Sphinx extension that allows you to build
galleries from jupyter notebooks (.ipynb), markdown (.md) or
reStructuredText (.rst) files.
This extension is functionally similar to the Sphinx-Gallery extension, but aim to provide a simple and efficient way to create galleries written in a variety of file formats.
Highlight Features
- Easy to use - It provides a set of
directivesto generate galleries, as simple as addingtoctree. - Flexible - You can easily generate a gallery of examples from your
Jupyter Notebooks, Markdown, or reStructuredText files. It works with
MySTEcosystem, including MyST-parser and MyST-NB, to render markdown or jupyter notebooks in Sphinx documentation. - Fast and robust - It utilizes existing images to generate gallery thumbnails, eliminating code execution delays and potential accidental errors when building gallery.
- Customizable - You can customize the gallery, such as thumbnail selection, and style of the gallery.
Documentation
The detailed documentation is available at: https://myst-sphinx-gallery.readthedocs.io/en/latest/
Quick Start
Installation
MyST Sphinx Gallery is a Python package, and requires Python >= 3.8. You can install the latest release using pip from the PyPI:
pip install myst_sphinx_gallery
or using conda / mamba from the conda-forge channel:
conda install -c conda-forge myst-sphinx-gallery
mamba install -c conda-forge myst-sphinx-gallery
Configuring the extension
Enable the extension
After installation, you can enable the extension in Sphinx conf.py file:
extensions = [
..., # other extensions
"myst_sphinx_gallery",
]
[!IMPORTANT] MyST Sphinx Gallery only helps you to generate the gallery. You need to enable the MyST parsers to render the markdown or jupyter notebook files by yourself.
For instance, to enable the MyST-NB, you can add the following code to the
conf.pyfile:extensions = [ ..., "myst_nb", ] source_suffix = { ".rst": "restructuredtext", ".md": "myst-nb", ".myst": "myst-nb", }For more information, please refer to the documentation of MyST and MyST-NB.
Configuring the variables
MyST Sphinx Gallery has two main configuration variables that can be set in
your conf.py file.
myst_sphinx_gallery_config: global configuration for all examples using gallery directives or used to generate galleries.myst_sphinx_gallery_files_config: configuration for individual files to override the global configuration for those files.
More details about the configuration variables can be found in the Configuration Variables section.
Generating gallery
There are two ways to generate galleries in MyST Sphinx Gallery:
- Using directives: MyST Sphinx Gallery provides three directives for generating galleries:
base-gallery,gallery, andref-gallery. You can directly use these directives to generate galleries in reStructuredText (.rst), Markdown (.md), and Jupyter Notebook (.ipynb) files. - Configuring in conf.py: You can also generate gallery by specifying the examples and gallery directories in your
conf.pyfile. This method is keeping in line with Sphinx Gallery extension.
You can refer to the Generating Galleries Methods section for more details.
Select the thumbnail for an example file
- one image - If there only one image in an example file, no additional configuration is needed, and that image will be used as the gallery thumbnail.
- multiple images - If there are multiple figures in an example file, you can specify the strategy to determine which thumbnail will be used for the gallery. The following strategies are supported:
- alt - If the alt attribute of an image/figure is set to gallery_thumbnail, that image/figure will be used as the gallery thumbnail for this file.
- first/last - If there are multiple images that can be used as the gallery thumbnail, the first/last image will be selected. You can specify the strategy by setting the thumbnail_strategy in the configuration file. The default value is first.
- code/markdown - For Jupyter notebook files, both markdown and code cells can contain images. You can specify the strategy by setting the notebook_thumbnail_strategy in the configuration file. The default value is code.
- no image - If no image/figure is found, the default thumbnail will be used.
More details can be found in the Thumbnail Strategies.
Customizing style of thumbnail and card
You can customize the layout and thumbnail behaviors for the gallery using the MyST Sphinx Gallery extension. For more details, please refer to the section Customizing Style of Thumbnail and Card .
Metadata
Release files for xara-sphinx-gallery 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| xara_sphinx_gallery-0.0.3.tar.gz | 46.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xara_sphinx_gallery-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 84.5 kB
Release files / xara_sphinx_gallery-0.0.3.tar.gz
| Download URL | xara_sphinx_gallery-0.0.3.tar.gz |
|---|---|
| Size | 46.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a7d89c86f9dfdbc0a4840785ce70ddd335d4e91b2f56b8f1019c4a959342f60
|
|
BLAKE2b-256 checksum How to use checksums |
874b8a8dd8227a871b1fd7a6acdbf5a965e49dac60d964846fc2f5cc75c23180
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / xara_sphinx_gallery-0.0.3-py3-none-any.whl
| Download URL | xara_sphinx_gallery-0.0.3-py3-none-any.whl |
|---|---|
| Size | 38.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1cf0b7b4b7fd4c1eaed331a96d8c12d3bc3578151220615ce1063caabb04500
|
|
BLAKE2b-256 checksum How to use checksums |
e1d74347cda34f487f560559e0f62c0ca9f2470f879a7d00f827ac1d1d94e739
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for xara-sphinx-gallery 0.0.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.