From e775fc6cdfe8745b05fbab50287690c90a02e733 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 15 Feb 2024 22:57:05 -0500 Subject: [PATCH] DOC: Use video files for saving animations Because the default is Base64-encoded frames of PNGs, this should save a substantial amount of space in the resulting docs. --- doc/conf.py | 7 ++++++- requirements/doc/doc-requirements.txt | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 1e6b3aefb5c5..3eed7c5bce78 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -195,6 +195,11 @@ def _check_dependencies(): subsectionorder as gallery_order_subsectionorder) from sphinxext.util import clear_basic_units, matplotlib_reduced_latex_scraper +if parse_version(sphinx_gallery.__version__) >= parse_version('0.17.0'): + sg_matplotlib_animations = (True, 'mp4') +else: + sg_matplotlib_animations = True + # The following import is only necessary to monkey patch the signature later on from sphinx_gallery import gen_rst @@ -273,7 +278,7 @@ def tutorials_download_error(record): 'image_scrapers': (matplotlib_reduced_latex_scraper, ), 'image_srcset': ["2x"], 'junit': '../test-results/sphinx-gallery/junit.xml' if CIRCLECI else '', - 'matplotlib_animations': True, + 'matplotlib_animations': sg_matplotlib_animations, 'min_reported_time': 1, 'plot_gallery': 'True', # sphinx-gallery/913 'reference_url': {'matplotlib': None}, diff --git a/requirements/doc/doc-requirements.txt b/requirements/doc/doc-requirements.txt index cee389da9e94..21b6ffa38dd1 100644 --- a/requirements/doc/doc-requirements.txt +++ b/requirements/doc/doc-requirements.txt @@ -18,6 +18,7 @@ pydata-sphinx-theme~=0.15.0 mpl-sphinx-theme~=3.9.0 pyyaml sphinxcontrib-svg2pdfconverter>=1.1.0 +sphinxcontrib-video>=0.2.1 sphinx-copybutton sphinx-design sphinx-gallery>=0.12.0