|
2 | 2 | #
|
3 | 3 | # For the full list of built-in configuration values, see the documentation:
|
4 | 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html
|
| 5 | + |
| 6 | +import os |
| 7 | + |
| 8 | +# need to force offscreen rendering before importing fpl |
| 9 | +# otherwise fpl tries to select glfw canvas |
| 10 | +os.environ["WGPU_FORCE_OFFSCREEN"] = "1" |
| 11 | + |
5 | 12 | import fastplotlib
|
| 13 | +from pygfx.utils.gallery_scraper import find_examples_for_gallery |
| 14 | +from pathlib import Path |
| 15 | +import sys |
| 16 | +from sphinx_gallery.sorting import ExplicitOrder |
| 17 | +import imageio.v3 as iio |
| 18 | + |
| 19 | +ROOT_DIR = Path(__file__).parents[1].parents[0] # repo root |
| 20 | +EXAMPLES_DIR = Path.joinpath(ROOT_DIR, "examples", "desktop") |
| 21 | + |
| 22 | +sys.path.insert(0, str(ROOT_DIR)) |
6 | 23 |
|
7 | 24 | # -- Project information -----------------------------------------------------
|
8 | 25 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
23 | 40 | "sphinx.ext.viewcode",
|
24 | 41 | "sphinx_copybutton",
|
25 | 42 | "sphinx_design",
|
26 |
| - "nbsphinx", |
| 43 | + "sphinx_gallery.gen_gallery" |
27 | 44 | ]
|
28 | 45 |
|
| 46 | +sphinx_gallery_conf = { |
| 47 | + "gallery_dirs": "_gallery", |
| 48 | + "backreferences_dir": "_gallery/backreferences", |
| 49 | + "doc_module": ("fastplotlib",), |
| 50 | + "image_scrapers": ("pygfx",), |
| 51 | + "remove_config_comments": True, |
| 52 | + "subsection_order": ExplicitOrder( |
| 53 | + [ |
| 54 | + "../../examples/desktop/image", |
| 55 | + "../../examples/desktop/gridplot", |
| 56 | + "../../examples/desktop/line", |
| 57 | + "../../examples/desktop/line_collection", |
| 58 | + "../../examples/desktop/scatter", |
| 59 | + "../../examples/desktop/heatmap", |
| 60 | + "../../examples/desktop/misc" |
| 61 | + ] |
| 62 | + ), |
| 63 | + "ignore_pattern": r'__init__\.py', |
| 64 | + "nested_sections": False, |
| 65 | + "thumbnail_size": (250, 250) |
| 66 | +} |
| 67 | + |
| 68 | +extra_conf = find_examples_for_gallery(EXAMPLES_DIR) |
| 69 | +sphinx_gallery_conf.update(extra_conf) |
| 70 | + |
| 71 | +# download imageio examples for the gallery |
| 72 | +iio.imread("imageio:clock.png") |
| 73 | +iio.imread("imageio:astronaut.png") |
| 74 | +iio.imread("imageio:coffee.png") |
| 75 | +iio.imread("imageio:hubble_deep_field.png") |
| 76 | + |
29 | 77 | autosummary_generate = True
|
30 | 78 |
|
31 | 79 | templates_path = ["_templates"]
|
|
52 | 100 | intersphinx_mapping = {
|
53 | 101 | "python": ("https://docs.python.org/3", None),
|
54 | 102 | "numpy": ("https://numpy.org/doc/stable/", None),
|
55 |
| - "pygfx": ("https://pygfx.com/stable/", None), |
| 103 | + "pygfx": ("https://pygfx.com/stable", None), |
56 | 104 | "wgpu": ("https://wgpu-py.readthedocs.io/en/latest", None),
|
57 | 105 | }
|
58 | 106 |
|
59 | 107 | html_theme_options = {
|
60 |
| - "source_repository": "https://github.com/kushalkolar/fastplotlib", |
| 108 | + "source_repository": "https://github.com/fastplotlib/fastplotlib", |
61 | 109 | "source_branch": "main",
|
62 | 110 | "source_directory": "docs/",
|
63 | 111 | }
|
0 commit comments