FIX: remove unused get_cmap and to_rgba imports in laffer_adaptive#798
Merged
Conversation
anaconda 2026.07 ships a matplotlib that has removed the long-deprecated
`matplotlib.cm.get_cmap`, so the first code cell of `laffer_adaptive.md`
fails at import time with:
ImportError: cannot import name 'get_cmap' from 'matplotlib.cm'
The symbol is never used anywhere in the lecture, so the import is simply
dropped rather than migrated to `matplotlib.colormaps[...]`.
Found while validating the anaconda 2026.06 -> 2026.07 bump (#797). See
QuantEcon/workspace-lectures#21 for the cross-repo validation status.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for taupe-gaufre-c4e660 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Removes a now-broken, long-deprecated Matplotlib import from laffer_adaptive.md to keep the lecture executing under the newer Anaconda/Matplotlib stack, without changing lecture outputs.
Changes:
- Drop the unused
from matplotlib.cm import get_cmapimport that now raisesImportErrorunder newer Matplotlib.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`to_rgba` is imported but never referenced anywhere in the lecture — the only occurrence in the file is the import statement itself. Unlike `get_cmap` this one is not yet fatal (matplotlib still ships `to_rgba`), but it is dead either way, so it goes with the same cleanup. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
✅ Translation sync completed (zh-cn)Target repo: QuantEcon/lecture-intro.zh-cn
|
This was referenced Jul 19, 2026
mmcky
added a commit
to QuantEcon/lecture-wasm
that referenced
this pull request
Jul 20, 2026
`matplotlib.cm.get_cmap` was removed in newer matplotlib releases, so
importing it raises `ImportError` at import time and kills the whole
notebook on its first cell:
ImportError: cannot import name 'get_cmap' from 'matplotlib.cm'
Neither `get_cmap` nor `to_rgba` is referenced anywhere in the lecture —
the only occurrence of each is its own import line — so both are dropped
rather than migrated to `matplotlib.colormaps[...]`.
This mirrors the fix in QuantEcon/lecture-python-intro#798, where the
same dead imports broke the notebook once anaconda 2026.07 shipped the
matplotlib that drops `get_cmap`. This repo runs under pyodide rather
than the conda env, so it was not covered by that sweep, but it carries
the identical imports and will break on the same matplotlib bump.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
anaconda 2026.07 ships a matplotlib that has finally removed the long-deprecated
matplotlib.cm.get_cmap. The first code cell oflaffer_adaptive.mdimports it, so the notebook now fails at import time before executing anything:This surfaced while validating the anaconda 2026.06 → 2026.07 bump (#797): the
cache.ymlrun on that branch (run 29685190525) failed with exactly one broken notebook — this one. Every other lecture built clean under-W --keep-going.Fix
Two dead imports are dropped from that cell:
from matplotlib.cm import get_cmapmatplotlib.colormaps[...]from matplotlib.colors import to_rgbato_rgbastill exists in matplotlib, so this is cleanup rather than a fixBoth were verified unused by checking every occurrence in the file — each symbol appears exactly once, on its own import line, with no reference anywhere else (compare
MaxNLocator,namedtupleandfsolve, which are each imported and used). Two lines deleted, no output changes.Why this targets
mainrather than the dependabot branchThe dead import is a latent bug independent of the env bump — it just happens to become fatal under 2026.07. Landing it on
mainkeeps the dependabot PR a cleanenvironment.yml-only diff, matching how the compat fixes were handled during the 2026.06 round (#776, #777). Once this merges I'll rebase #797 and re-dispatchcache.ymlto confirm a fully green validation build.Cross-repo validation status is tracked in QuantEcon/workspace-lectures#21.
Note for reviewers: the bare
import matplotlibon the following line also appears to be unused — there are nomatplotlib.<attr>references outside the import block. I have left it in place as it is out of scope for this fix, but happy to drop it here if preferred.