Skip to content

Kaleido lectures: drop to_image's deprecated engine argument - #421

Merged
mmcky merged 1 commit into
mainfrom
plotly-to-image-no-engine
Nov 23, 2026
Merged

mmcky merged 1 commit into
mainfrom
plotly-to-image-no-engine

Conversation

@mmcky

@mmcky mmcky commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What

BCG_complete_mkts (1 call), BCG_incomplete_mkts (5) and knowing_forecasts_of_others (1) export their plotly figures with fig.to_image(format="png", engine="kaleido"). Plotly has deprecated the engine argument: it uses Kaleido whenever Kaleido is installed, and falls back to its deprecated Orca engine only when it is not. So each of the seven calls prints this into its output:

DeprecationWarning: Support for the 'engine' argument is deprecated and will be removed after September 2025. Kaleido will be the only supported engine at that time.

Before After
Image(fig.to_image(format="png", engine="kaleido")) (and fig1 once) Image(fig.to_image(format="png"))

Without the argument plotly uses Kaleido all the same, so the images should be unchanged. The warnings were found by the environment scan of 2026-11-19, and they are also in the build of this site from the lecture monorepo (QuantEcon/lectures#86). This is part of reporting lecture fixes upstream to each lecture's source of truth (QuantEcon/project-monorepo#77).

Validation

Done on 2026-11-22, a full validation: fresh builds with no cache of this pull request and of main, every notebook executed, both green. The evidence is in the comment below.

This changes lecture content, so it needs a person's review.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL

BCG_complete_mkts, BCG_incomplete_mkts and knowing_forecasts_of_others
call plotly's fig.to_image(format="png", engine="kaleido"). Plotly has
deprecated the engine argument, since Kaleido is now its only engine, so
each of the seven calls printed a DeprecationWarning ("Support for the
'engine' argument is deprecated and will be removed after September 2025.
Kaleido will be the only supported engine at that time.") into its
output. Without the argument plotly uses Kaleido all the same, so the
images are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL
@netlify

netlify Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for lustrous-melomakarona-3ee73e ready!

Name Link
🔨 Latest commit a87f1bb
🔍 Latest deploy log https://app.netlify.com/projects/lustrous-melomakarona-3ee73e/deploys/6b02c27643a8f975bdf66d08
😎 Deploy Preview https://deploy-preview-421--lustrous-melomakarona-3ee73e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request November 22, 2026 10:39 Inactive
@mmcky

mmcky commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Validation: a full validation

Two fresh builds with no cache, each executing all 77 notebooks, -W --keep-going, both green:

Build Run
main at 354faf5, this branch's base, 2026-11-22 45012283119
this pull request at a87f1bb, 2026-11-22 45012294654

The three Kaleido lectures. In each, the seven DeprecationWarnings are gone, and every image is byte-identical to main's. The only other difference is the CPU time one cell prints.

Lecture DeprecationWarnings, main → this pull request images, byte-identical
BCG_complete_mkts 1 → 0 4 of 4
BCG_incomplete_mkts 5 → 0 10 of 10
knowing_forecasts_of_others 1 → 0 4 of 4

Build logs. The same warning lines on both sides, and no Sphinx warning on either.

The rest of the HTML. 37 of 85 pages differ in all. Besides the three above, there are 33 pages of output noise or figure file names, the same as between any two builds: unseeded draws, timings, memory addresses and solver printouts, and figures drawn again with new names. There is also the status page, with its build times. The warnings in the other pages' outputs are the same on both sides.

@mmcky
mmcky marked this pull request as ready for review November 22, 2026 11:33
Copilot AI adaptive review requested due to automatic review settings November 22, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Because the PR changes executable lecture content and rendered figures across three pages, confirming Plotly/Kaleido output and narrative alignment requires environment-specific execution and human review.

No open issues 🎉

What changed in this PR

This PR removes Plotly’s deprecated engine="kaleido" argument from lecture figure exports, eliminating deprecation warnings while preserving PNG rendering through Kaleido’s default behavior.

Changes:

  • Updated one image export in knowing_forecasts_of_others.md.
  • Updated five image exports in BCG_incomplete_mkts.md.
  • Updated one image export in BCG_complete_mkts.md.
File Description
lectures/​knowing_forecasts_of_others.md Removes the deprecated engine argument from one Plotly image export.
lectures/​BCG_incomplete_mkts.md Removes the deprecated engine argument from five Plotly image exports.
lectures/​BCG_complete_mkts.md Removes the deprecated engine argument from one Plotly image export.

Review effort: Lite (adaptive)

@mmcky

mmcky commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Validation correction: pages whose only difference is a figure

The evidence comment above says 37 of 85 pages differ. The comparison behind it compared a figure only when the page wraps it in a link, and this series doesn't, so a page whose only difference is a figure wasn't counted. With every figure now compared by content, 52 of 85 pages differ. The 15 added pages differ only in figures:

Page Figures that differ, and why
additive_functionals figures 1 to 3 of 10, from lss.simulate, which draws without a seed
cattle_cycles figure 1 of 3, from compute_sequence, which draws its shocks without a seed
entrepreneurial_stock_market figures 2, 4 and 6 of 9, on 37 pixels in all, each by one shade level in 255: anti-aliasing, invisible; no random draws are behind them
estspec figures 1, 6 and 7 of 7, from ARMA.simulation, which draws without a seed
gradual_trade_agreements figure 2 of 3, on 1 pixel in all, each by one shade level in 255: anti-aliasing, invisible; no random draws are behind them
lqramsey figures 1 to 6 of 6, from paths drawn with numpy's unseeded randn
lucas_model figures 1 and 3 of 3, from unseeded draws (ϕ.rvs)
markov_jump_lq figure 22 of 22, from compute_sequence, which draws its shocks without a seed
muth_kalman figures 1 to 3 of 4, from ssf.simulate, which draws without a seed
permanent_income_dles figure 1 of 1, from compute_sequence, which draws its shocks without a seed
risk_aversion_or_mistaken_beliefs figure 8 of 13: the same plot, saved 490 pixels high on main's side and 489 on this side, so every row below the change shifts; I haven't found why the crop moved
smoothing figures 1 and 2 of 2: figure 1 from a simulation whose seed is itself drawn at random (np.random.randint); figure 2 on 422 pixels, each by one shade level in 255 (anti-aliasing, invisible)
tax_smoothing_1 figures 1 to 3 of 3, from compute_sequence, which draws its shocks without a seed
tax_smoothing_2 figures 1 to 4 of 4, from compute_sequence, which draws its shocks without a seed
tax_smoothing_3 figures 1 and 2 of 2, from compute_sequence, which draws its shocks without a seed

This pull request's own pages. The three Kaleido lectures it changes have byte-identical images on both sides, as the evidence comment says.

None of the added pages is one this pull request changes, and each also differs when the same main build is compared with the build of #423, which changes only the conda channel's name and installs the same packages. The conclusion doesn't change: no other page's prose differs.

@mmcky
mmcky merged commit e00b910 into main Nov 23, 2026
11 checks passed
@mmcky
mmcky deleted the plotly-to-image-no-engine branch November 23, 2026 00:08
mmcky pushed a commit to QuantEcon/lectures that referenced this pull request Nov 23, 2026
The nightly of 2026-11-23 re-copies 19 pool lectures whose canonical copy moved upstream: intermediate 12 (QuantEcon/lecture-python.myst#1144, QuantEcon/lecture-python.myst#1147 and QuantEcon/lecture-python.myst#1141), advanced 5 (QuantEcon/lecture-python-advanced.myst#419, QuantEcon/lecture-python-advanced.myst#421 and QuantEcon/lecture-python-advanced.myst#422) and intro 2 (QuantEcon/lecture-python-intro#876). In the merged bibliography only the header's jax input hash changes (QuantEcon/lecture-jax#377); its 1011 entries are unchanged. In sync/ledger.yml only pins and digests change.

Checked by mini:project-monorepo's recompute from a clean clone at the base, which gives the head's tree, and by the organiser's independent review: each lecture is byte-identical to its upstream copy at the new pin once the recorded asset rewrites are applied, no bibliography key is missing and no cross-reference is broken. The site-build, pool-check and drift-check runs on the head were green before merge.

Lecture content: reviewed by @mmcky ("Approve runs, then merge") in the organiser session, at head a815b36.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
pull request — a87f1bb6 Deployed Nov 22, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants