Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A Sphinx extension that builds an HTML gallery of examples from any set of Python scripts.
.. image:: https://img.shields.io/pypi/v/sphinx-gallery :target: https://pypi.org/project/sphinx-gallery/ :alt: PyPI
.. image:: https://img.shields.io/conda/vn/conda-forge/sphinx-gallery :target: https://anaconda.org/conda-forge/sphinx-gallery :alt: Conda-forge
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3741780.svg :target: https://doi.org/10.5281/zenodo.3741780 :alt: Zenodo DOI
.. image:: https://dev.azure.com/sphinx-gallery/sphinx-gallery/_apis/build/status/sphinx-gallery.sphinx-gallery?branchName=master :target: https://dev.azure.com/sphinx-gallery/sphinx-gallery/_build/latest?definitionId=1&branchName=master :alt: Azure CI status
.. image:: https://circleci.com/gh/sphinx-gallery/sphinx-gallery.svg?style=shield :target: https://circleci.com/gh/sphinx-gallery/sphinx-gallery :alt: CircleCI status
.. image:: https://codecov.io/github/sphinx-gallery/sphinx-gallery/badge.svg?branch=master&service=github( :target: https://app.codecov.io/github/sphinx-gallery/sphinx-gallery :alt: Code coverage
.. tagline-begin-content
A Sphinx <https://www.sphinx-doc.org/en/master/>
_ 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...
.. tagline-end-content
.. image:: doc/_static/demo.png :width: 80% :alt: A demo of a gallery generated by Sphinx-Gallery
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...
pip
.. installation-begin-content
You can do a direct install via pip
by using:
.. code-block:: bash
$ pip install sphinx-gallery
.. tip::
Sphinx-Gallery also has support for scraping images from Matplotlib
and Matplotlib-based packages such as Seaborn.
We recommend installing system optipng
binaries to reduce
the file sizes of the generated PNG files.
.. installation-end-content
Let's assume simple scenario, you have a Python package with a directory structure like this:
.. code-block::
├── 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
:
.. code-block:: python
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.
An incomplete list:
.. projects_list_start
Apache TVM <https://tvm.apache.org/docs/tutorial/index.html>
_Astropy <https://docs.astropy.org/en/stable/generated/examples/index.html>
_auto-sklearn <https://automl.github.io/auto-sklearn/master/examples/index.html>
_Biotite <https://www.biotite-python.org/examples/gallery/index.html>
_Cartopy <https://scitools.org.uk/cartopy/docs/latest/gallery/>
_FURY <https://fury.gl/latest/auto_examples/index.html>
_pyGIMLi <https://www.pygimli.org/_examples_auto/index.html>
_HyperSpy <https://hyperspy.org/hyperspy-doc/current/>
_kikuchipy <https://kikuchipy.org>
_Matplotlib <https://matplotlib.org/stable/index.html>
_MNE-Python <https://mne.tools/stable/auto_examples/index.html>
_napari <https://napari.org/stable/gallery.html>
_Nestle <http://kylebarbary.com/nestle/examples/index.html>
_NetworkX <https://networkx.org/documentation/stable/auto_examples/index.html>
_Neuraxle <https://www.neuraxle.org/stable/examples/index.html>
_Nilearn <https://nilearn.github.io/stable/auto_examples/index.html>
_OpenML <https://openml.github.io/openml-python/main/examples/index.html>
_OpenTURNS <https://openturns.github.io/openturns/latest/examples/examples.html>
_Optuna <https://optuna.readthedocs.io/en/stable/tutorial/index.html>
_PlasmaPy <https://docs.plasmapy.org/en/latest/examples.html>
_PyGMT <https://www.pygmt.org/latest/gallery/index.html>
_pyRiemann <https://pyriemann.readthedocs.io/en/latest/index.html>
_PyStruct <https://pystruct.github.io/auto_examples/index.html>
_PySurfer <https://pysurfer.github.io/>
_PyTorch tutorials <https://pytorch.org/tutorials>
_PyVista <https://docs.pyvista.org/examples/>
_pyxem <https://pyxem.readthedocs.io>
_RADIS <https://radis.readthedocs.io/en/latest/auto_examples/index.html>
_scikit-image <https://scikit-image.org/docs/dev/auto_examples/>
_scikit-learn <https://scikit-learn.org/stable/auto_examples/index.html>
_SimPEG <https://docs.simpeg.xyz/content/examples/>
_Sphinx-Gallery <https://sphinx-gallery.github.io/stable/auto_examples/index.html>
_SunPy <https://docs.sunpy.org/en/stable/generated/gallery/index.html>
_Tonic <https://tonic.readthedocs.io/en/latest/auto_examples/index.html>
_TorchIO <https://torchio.readthedocs.io/auto_examples/index.html>
_.. projects_list_end
You can get the latest development source from our Github repository <https://github.com/sphinx-gallery/sphinx-gallery>
_. You need
setuptools
installed in your system to install Sphinx-Gallery. For example,
you can do:
.. code-block:: console
$ 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:
.. code-block:: console
$ pytest sphinx_gallery
.. citation-begin-content
If you would like to cite Sphinx-Gallery you can do so using our Zenodo deposit <https://zenodo.org/record/3741780>
_.
.. _documentation: https://sphinx-gallery.github.io/
.. citation-end-content
FAQs
A Sphinx extension that builds an HTML gallery of examples from any set of Python scripts.
We found that sphinx-gallery demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.