Use plt.get_cmap instead of removed-in-3.11 plt.cm.get_cmap - #9
Merged
Merged
Conversation
`scatter_and_color_according_to_y` resolved its colormap via `plt.cm.get_cmap` (i.e. `matplotlib.cm.get_cmap`), which matplotlib deprecated in 3.7 with `removal='3.11'`. Since the package pins no matplotlib upper bound, the continuous-`y` branch of this public, `__init__`-exported function would start raising `AttributeError` as soon as users pick up 3.11. Switch to `plt.get_cmap`, the non-deprecated spelling matplotlib's own warning points at. Verified equivalent under matplotlib 3.10 for every argument form the call site can produce -- str, `Colormap`, and `None` all yield the same colormap type and an identical 256-sample lookup table, and invalid input still raises `ValueError` from both spellings. The change is therefore observationally inert apart from dropping the warning. Adds a regression test asserting the float-`y` path emits no `MatplotlibDeprecationWarning`; it fails on the unmodified code with the `get_cmap ... will be removed in 3.11` message and passes after. Suite: 74 passed before, 75 passed after (the one new test). Two pre-existing failures under the CI `--doctest-modules` invocation are untouched and unrelated: `oplot/my.py` fails to import (`nympy` typo) and the `plot_stats.smooth_scores` doctest fails; both reproduce identically on the unmodified tree. Claude-Session: https://claude.ai/code/session_01L1aQPB34n7PU7jmbztSjBe
This was referenced Sep 22, 2026
thorwhalen
added a commit
that referenced
this pull request
Sep 22, 2026
#11) * fix: migrate CI off legacy isee-based workflow onto wads-managed uv CI Fixes #8: the legacy .github/workflows/ci.yml pinned Python 3.8 and installed an unpinned isee (which pulls in wads); the currently-published wads uses dict[str, Any] at module level, a TypeError on 3.8. Every push/PR has shown red CI for this reason regardless of what changed, since before #9 landed (gated on a local pytest run instead, per that PR's own notes). Migration (durable fix option from #8, following the wads-migrate skill): - setup.cfg/setup.py -> pyproject.toml (wads-migrate setup-to-pyproject), with the known rough edges fixed by hand: SPDX license string instead of the deprecated [project.license] text table; project_name set to "oplot"; testpaths widened to ["oplot", "tests"] (the old CI actually ran `pytest --doctest-modules $PROJECT_NAME`, i.e. the package itself, so this preserves that doctest coverage rather than narrowing it to tests/ only); disabled the dead [tool.wads.ci.metrics] gate (config_path points at a file that doesn't exist, same pattern already fixed in git2py/focal). - .github/workflows/ci.yml -> the modern uv-based template (wads-migrate ci-to-uv). Widening test collection to the package surfaced two real, pre-existing bugs invisible under the broken CI: - oplot/my.py: `import nympy as np` (typo) made an already-orphaned, unimported module fail to even import. Fixed the typo; the module is still dead code (not referenced from oplot/__init__.py), out of scope here. - oplot/plot_stats.py: smooth_scores's doctest asserted numpy<2.0's bare scalar repr (`[1.5]`, `[2, 3]`); currently-installed numpy 2.x reprs scalars as `np.float64(1.5)` / `np.int64(2)`. Not a logic bug -- updated the expected values to match current numpy's actual (correct) behavior. Also applied `ruff format` fleet-wide (quote style, blank lines) to satisfy the new CI's format-check gate -- no logic changes. Dependents check: oplot's one known local dependent, `shaded`, only imports `oplot.plot_data_set.scatter_and_color_according_to_y` (a module untouched by this change); its test suite runs clean (2 skipped, needs audio fixtures not present, 0 failed) against this branch. Closes #8 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: force MPLBACKEND=Agg in CI (Windows Tests hung on plt.show()) The Windows leg (just enabled by this branch's CI migration -- the old workflow never had a Windows job at all) hung indefinitely instead of completing: several oplot modules' doctests call plt.show(), and with no non-interactive backend forced, matplotlib picked a GUI backend on the Windows runner that blocked rather than no-op'ing (unlike Linux, which has no DISPLAY and falls back to Agg automatically). Set MPLBACKEND=Agg via [tool.wads.ci.env.defaults] (re-ran wads-migrate ci-to-uv to wire it into the generated workflow's env: block). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.
scatter_and_color_according_to_yresolved its colormap viaplt.cm.get_cmap(i.e.
matplotlib.cm.get_cmap), which matplotlib deprecated in 3.7 withremoval='3.11'. Since the package pins no matplotlib upper bound, thecontinuous-
ybranch of this public,__init__-exported function would startraising
AttributeErroras soon as users pick up 3.11.Switches to
plt.get_cmap, the non-deprecated spelling matplotlib's ownwarning points at. Verified equivalent under matplotlib 3.10 for every
argument form the call site can produce (str,
Colormap,None) — samecolormap type, identical 256-sample lookup table, invalid input still raises
ValueErrorfrom both spellings. Observationally inert apart from droppingthe warning.
Adds a regression test asserting the float-
ypath emits noMatplotlibDeprecationWarning.No related open issue found (searched for "cmap"; #1 is about a different pair
of problems in the same function — an LDA/PCA fallback warning and a missing
ax.colorbar()— left untouched, out of scope here).Branch sat pushed with red CI and no PR for two weeks (thorwhalen/fleet_stuff
cleanup). Verified: master has not moved since the branch was cut (no rebase
needed).
CI note: hosted CI is red on this branch, but for a pre-existing reason
unrelated to this change — the
Validation (3.8)job fails atInstall dependencies(isee/wadsnow require Python 3.9+ syntax, theworkflow pins 3.8). Master's own last CI run fails identically
(https://github.com/i2mint/oplot/actions/runs/19587236188). Filed as #8;
out of scope to fix here. Gated instead on a direct
pytestrun in a freshvenv with matplotlib 3.11.2 (the exact removal version) — no
pyproject.toml/[tool.wads.ci]in this repo, sowads ci-localdoesn'tapply either. Result: 75/75 passed, including the new regression test.
--doctest-moduleson the package also reproduces the two pre-existing,unrelated failures the original commit called out (
oplot/my.pyimporting anonexistent
nympymodule — confirmed present on unmodified master too — andan unrelated
plot_stats.smooth_scoresdoctest) — neither touched here.🤖 Generated with Claude Code