Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sphinx extension for automatic generation of an example gallery

License

NotificationsYou must be signed in to change notification settings

sphinx-gallery/sphinx-gallery

Repository files navigation

PyPIConda-forgeZenodo DOIAzure CI statusCircleCI statusCode coverage

ASphinx extension that builds anHTML gallery of examples from any set of Python scripts.Check out thedocumentation for introductions on how to use it and more...

A demo of a gallery generated by Sphinx-Gallery

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 particularPython package, module, or class.

Let's get started with a simple example or check out the
documentation for introductions on howto use it and more...

Install viapip

You can do a direct install viapip by using:

$ pip install sphinx-gallery

Tip

Sphinx-Gallery also has support for scraping images from Matplotliband Matplotlib-based packages such as Seaborn.We recommend installing systemoptipng binaries to reducethe file sizes of the generated PNG files.

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 yourdoc/conf.py:

extensions= [    ...'sphinx_gallery.gen_gallery',]# path to the examples scriptssphinx_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 inauto_examples/.Add a link toauto_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 ourGithub repository. You needsetuptools 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 ourZenododeposit.


[8]ページ先頭

©2009-2025 Movatter.jp