-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathconf.py
More file actions
139 lines (117 loc) · 4.36 KB
/
conf.py
File metadata and controls
139 lines (117 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
# need to force offscreen rendering before importing fpl
# otherwise fpl tries to select glfw canvas
os.environ["WGPU_FORCE_OFFSCREEN"] = "1"
import fastplotlib
from pygfx.utils.gallery_scraper import find_examples_for_gallery
from pathlib import Path
import sys
from sphinx_gallery.sorting import ExplicitOrder
import imageio.v3 as iio
ROOT_DIR = Path(__file__).parents[1].parents[0] # repo root
EXAMPLES_DIR = Path.joinpath(ROOT_DIR, "examples")
sys.path.insert(0, str(ROOT_DIR))
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = "fastplotlib"
copyright = "2022-2026, Kushal Kolar, Caitlin Lewis"
author = "Kushal Kolar, Caitlin Lewis"
release = fastplotlib.__version__
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx_copybutton",
"sphinx_design",
"sphinx_gallery.gen_gallery",
]
sphinx_gallery_conf = {
"gallery_dirs": "_gallery",
"notebook_extensions": {}, # remove the download notebook button
"backreferences_dir": "_gallery/backreferences",
"doc_module": ("fastplotlib",),
"image_scrapers": ("pygfx",),
"remove_config_comments": True,
"subsection_order": ExplicitOrder(
[
"../../examples/image",
"../../examples/image_volume",
"../../examples/heatmap",
"../../examples/image_widget",
"../../examples/gridplot",
"../../examples/window_layouts",
"../../examples/controllers",
"../../examples/line",
"../../examples/line_collection",
"../../examples/mesh",
"../../examples/scatter",
"../../examples/vectors",
"../../examples/text",
"../../examples/events",
"../../examples/selection_tools",
"../../examples/spaces_transforms",
"../../examples/machine_learning",
"../../examples/guis",
"../../examples/ipywidgets",
"../../examples/misc",
"../../examples/qt",
]
),
"ignore_pattern": r"__init__\.py",
"nested_sections": False,
"thumbnail_size": (250, 250),
}
extra_conf = find_examples_for_gallery(EXAMPLES_DIR)
sphinx_gallery_conf.update(extra_conf)
# download imageio examples for the gallery
iio.imread("imageio:clock.png")
iio.imread("imageio:astronaut.png")
iio.imread("imageio:coffee.png")
iio.imread("imageio:hubble_deep_field.png")
autosummary_generate = True
templates_path = ["_templates"]
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = "pydata_sphinx_theme"
html_theme_options = {
"navbar_end": ["theme-switcher", "version-switcher", "navbar-icon-links"],
"show_version_warning_banner": True,
"check_switcher": True,
"switcher": {
"json_url": "http://www.fastplotlib.org/_static/switcher.json",
"version_match": release,
},
"icon_links": [
{
"name": "Github",
"url": "https://github.com/fastplotlib/fastplotlib",
"icon": "fa-brands fa-github",
}
],
}
html_static_path = ["_static"]
html_logo = "_static/logo.png"
html_title = f"v{release}"
autodoc_member_order = "groupwise"
autoclass_content = "both"
add_module_names = False
autodoc_typehints = "description"
autodoc_typehints_description_target = "documented_params"
autodoc_preserve_defaults = True
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable", None),
"pygfx": ("https://docs.pygfx.org/stable", None),
"wgpu": ("https://wgpu-py.readthedocs.io/en/latest", None),
"rendercanvas": ("https://rendercanvas.readthedocs.io/stable/", None),
# "fastplotlib": ("https://www.fastplotlib.org/", None),
}