Skip to content

Commit 2a05f9e

Browse files
authored
Move sphinx-gallery as an optional dependency for testing (#2439)
1 parent bdf5b1e commit 2a05f9e

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

.github/workflows/ci_doctests.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ jobs:
6464
pytest
6565
pytest-doctestplus
6666
pytest-mpl
67-
sphinx-gallery
6867
6968
# Download cached remote files (artifacts) from GitHub
7069
- name: Download remote data from GitHub

.github/workflows/ci_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
geopandas
7373
ipython
7474
rioxarray
75+
sphinx-gallery
7576
7677
timeout-minutes: 30
7778
defaults:
@@ -123,7 +124,6 @@ jobs:
123124
pytest-cov
124125
pytest-doctestplus
125126
pytest-mpl
126-
sphinx-gallery
127127
128128
# Download cached remote files (artifacts) from GitHub
129129
- name: Download remote data from GitHub

.github/workflows/ci_tests_legacy.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ jobs:
7979
pytest
8080
pytest-doctestplus
8181
pytest-mpl
82-
sphinx-gallery
8382
8483
# Download cached remote files (artifacts) from GitHub
8584
- name: Download remote data from GitHub

pygmt/sphinx_gallery.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
Utilities for using pygmt with sphinx-gallery.
33
"""
44

5-
import sphinx_gallery.scrapers
5+
try:
6+
from sphinx_gallery.scrapers import figure_rst
7+
except ImportError:
8+
figure_rst = None
69
from pygmt.figure import SHOWED_FIGURES
710

811

@@ -29,4 +32,4 @@ def __call__(self, block, block_vars, gallery_conf):
2932
fig = figures.pop(0)
3033
fig.savefig(fname, transparent=True, dpi=200)
3134
image_names.append(fname)
32-
return sphinx_gallery.scrapers.figure_rst(image_names, gallery_conf["src_dir"])
35+
return figure_rst(image_names, gallery_conf["src_dir"])

0 commit comments

Comments
 (0)