10000 DOC/BUILD add ability for conf to skip whole sections · matplotlib/matplotlib@53695e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 53695e9

Browse files
committed
DOC/BUILD add ability for conf to skip whole sections
1 parent 5793ebb commit 53695e9

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

doc/conf.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@
3434
# are we running circle CI?
3535
CIRCLECI = 'CIRCLECI' in os.environ
3636

37+
# shortcuts: subdirectories to not build. Should be relative
38+
# to the doc directory. Note that you cannot skip "users"
39+
# but can skip subdirectories...
40+
#
41+
# Note if any of the sphinx-galleries are skipped then they
42+
# will not be built using sphinx-gallery.
43+
skip_subdirs = []
44+
if False:
45+
skip_subdirs = ['users/prev_whats_new/*',
46+
'gallery/*',
47+
'api/*',
48+
'tutorials/*',
49+
'plot_types/*',
50+
'devel/*']
51+
3752
# Parse year using SOURCE_DATE_EPOCH, falling back to current time.
3853
# https://reproducible-builds.org/specs/source-date-epoch/
3954
sourceyear = datetime.utcfromtimestamp(
@@ -80,9 +95,10 @@
8095
]
8196

8297
exclude_patterns = [
83-
'api/prev_api_changes/api_changes_*/*',
98+
'api/prev_api_changes/api_changes_*/*'
8499
]
85100

101+
exclude_patterns += skip_subdirs
86102

87103
def _check_dependencies():
88104
names = {
@@ -157,7 +173,6 @@ def _check_dependencies():
157173
'xarray': ('https://docs.xarray.dev/en/stable/', None),
158174
}
159175

160-
161176
# Sphinx gallery configuration
162177

163178
def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
@@ -174,13 +189,20 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
174189
gallery_conf['image_srcset'] = []
175190
return matplotlib_scraper(block, block_vars, gallery_conf, **kwargs)
176191

192+
example_dirs = []
193+
if 'gallery/*' not in skip_subdirs:
194+
example_dirs += ['../examples']
195+
if 'tutorials/*' not in skip_subdirs:
196+
example_dirs += ['../tutorials']
197+
if 'plot_types/*' not in skip_subdirs:
198+
example_dirs += ['../plot_types']
177199

178200
sphinx_gallery_conf = {
179201
'backreferences_dir': Path('api') / Path('_as_gen'),
180202
# Compression is a significant effort that we skip for local and CI builds.
181203
'compress_images': ('thumbnails', 'images') if is_release_build else (),
182204
'doc_module': ('matplotlib', 'mpl_toolkits'),
183-
'examples_dirs': ['../examples', '../tutorials', '../plot_types'],
205+
'examples_dirs': example_dirs,
184206
'filename_pattern': '^((?!sgskip).)*$',
185207
'gallery_dirs': ['gallery', 'tutorials', 'plot_types'],
186208
'image_scrapers': (matplotlib_reduced_latex_scraper, ),

0 commit comments

Comments
 (0)
0