Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert all notebooks to sphinx gallery format #2377

Merged
merged 17 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,4 @@ distribute-*.tar.gz
target
.mypy_cache

examples/notebooks/*.html
examples/notebooks/*.png

provenance.log
7 changes: 7 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ help:

clean:
rm -rf api
rm -rf user-guide/examples/*.zip
rm -rf user-guide/examples/*.rst
rm -rf user-guide/examples/*/*.ipynb
rm -rf user-guide/examples/*/*.py.md5
rm -rf user-guide/examples/*/*.pickle
rm -rf user-guide/examples/*/*.rst
rm -rf user-guide/examples/*/images
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)


Expand Down
37 changes: 36 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
# Get configuration information from setup.cfg
from configparser import ConfigParser

# Sphinx gallery
from sphinx_gallery.sorting import ExplicitOrder, FileNameSortKey

import ctapipe

setup_cfg = ConfigParser()
Expand All @@ -55,6 +58,7 @@
"numpydoc",
"sphinx_design",
"IPython.sphinxext.ipython_console_highlighting",
"sphinx_gallery.gen_gallery",
]


Expand Down Expand Up @@ -142,6 +146,34 @@ def setup(app):
("py:class", "ctapipe.compat.StrEnum"),
]

# Sphinx gallery config

sphinx_gallery_conf = {
"examples_dirs": [
"user-guide/examples",
], # path to your example scripts
"gallery_dirs": [
"user-guide/examples",
], # path to where to save gallery generated output
"subsection_order": ExplicitOrder(
[
"user-guide/examples/tutorials",
"user-guide/examples/algorithms",
"user-guide/examples/core",
"user-guide/examples/visualization",
]
),
"within_subsection_order": FileNameSortKey,
"nested_sections": False,
# "copyfile_regex": r".*\.rst|.*\.png|.*\.json",
"filename_pattern": r".*\.py",
"promote_jupyter_magic": True,
"line_numbers": True,
"default_thumb_file": "_static/ctapipe_logo.png",
"pypandoc": True,
"matplotlib_animations": True,
}


# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
Expand Down Expand Up @@ -195,6 +227,9 @@ def setup(app):
".DS_Store",
"**.ipynb_checkpoints",
"changes",
"user-guide/examples/*/*.ipynb",
"user-guide/examples/*/*.py",
"user-guide/examples/*/README.rst",
]

# The name of the Pygments (syntax highlighting) style to use.
Expand All @@ -209,7 +244,7 @@ def setup(app):
# Define the json_url for our version switcher.
json_url = "https://ctapipe.readthedocs.io/en/latest/_static/switcher.json"

# Define the version we use for matching in the version switcher.
# Define the version we use for matching in the version switcher.,
version_match = os.getenv("READTHEDOCS_VERSION")
# If READTHEDOCS_VERSION doesn't exist, we're not on RTD
# If it is an integer, we're in a PR build and the version isn't correct.
Expand Down
Loading
Loading