Skip to content

Commit b120480

Browse files
larsonerclaude
andcommitted
test: update the repr html template for the new fallback size
The vnd.plotly mimetype renderers produce no text/html bundle, so _repr_html_ takes the fallback branch, which now sizes like the html renderers (525px default). Also point the no-static-export warning at the plotly_get_chrome command, which is the fix when kaleido is installed but no browser is available (e.g. on ReadTheDocs). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent e3b9563 commit b120480

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

plotly/io/_sg_scraper.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ def plotly_sg_scraper(block, block_vars, gallery_conf, **kwargs):
5959
that it can also serve as the thumbnail; its HTML is embedded by
6060
sphinx-gallery itself.
6161
62-
Static image export requires Kaleido and a Chromium-based browser; when
63-
unavailable, a warning is emitted once per build and the examples fall
64-
back to placeholder thumbnails, with the interactive figures unaffected.
62+
Static image export requires Kaleido and a Chromium-based browser (the
63+
``plotly_get_chrome`` command installs one); when unavailable, a warning
64+
is emitted once per build and the examples fall back to placeholder
65+
thumbnails, with the interactive figures unaffected.
6566
6667
Parameters
6768
----------
@@ -160,9 +161,10 @@ def _static_export_available():
160161
warn(
161162
"plotly static image export is unavailable, so example "
162163
"thumbnails will fall back to a placeholder image. Static "
163-
"export requires Kaleido and a Chromium-based browser; see "
164-
"https://plotly.com/python/static-image-export/ for "
165-
"installation instructions. The failure was: %s: %s",
164+
"export requires Kaleido and a Chromium-based browser "
165+
"(the `plotly_get_chrome` command installs one); see "
166+
"https://plotly.com/python/static-image-export/ for details. "
167+
"The failure was: %s: %s",
166168
type(exc).__name__,
167169
exc,
168170
)

tests/test_io/test_renderers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ def test_repr_html(renderer):
322322
plotlyjs_content = get_plotlyjs()
323323
sri_hash = _generate_sri_hash(plotlyjs_content)
324324

325+
# The fallback sizes like the html renderers: layout height, else 525px
325326
template = (
326-
'<div style="height:100%; width:100%;"> <script>'
327+
'<div style="height:525px; width:100%;"> <script>'
327328
"window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n "
328329
'<script charset="utf-8" src="'
329330
+ plotly_cdn_url()

0 commit comments

Comments
 (0)