Repository navigation
BLD: Install the type stub for backends.registry - #32481
Merged
Merged
Conversation
QuLogic
approved these changes
Oct 16, 2026
iccir
pushed a commit
that referenced
this pull request
Oct 16, 2026
iccir
added a commit
that referenced
this pull request
Oct 16, 2026
…481-on-v3.11.x Backport PR #32481 on branch v3.11.x (BLD: Install the type stub for backends.registry)
1 task done
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.
PR summary
lib/matplotlib/backends/registry.pyiwas added in 3.9 (#27719) but is notlisted in
typing_sourcesinlib/matplotlib/backends/meson.build, so ithas never been installed. Wheels from 3.9.0 to 3.11.2 ship
registry.pywithout it.
Because
py.typedis installed, type checkers read the unannotatedregistry.pyinstead. They still know thatbackend_registryis aBackendRegistry, but all its methods are untyped. With mypy on aninstalled wheel:
Under
mypy --strict, each of these calls is currently ano-untyped-callerror.This PR adds the file to the list. A wheel built with the change has
registry.pyias its only new file, and stubtest reports no differencesbetween the stub and the runtime module. I ran it without the allowlist,
because
ci/mypy-stubtest-allowlist.txtskips everything undermatplotlib.backends.The two other uninstalled stubs are left out on purpose:
backends/backend_pdf.pyihas annotation errors that would reject validcode once installed, e.g.
PdfPages.savefig(fig, dpi=300). I'll fix andinstall it in a follow-up PR.
dates.pyicovers only the module's functions, so installing it would makefrom matplotlib.dates import DateFormattera type error. It can be addedonce the stub is complete (Add type hints for matplotlib.dates module #30126).
AI Disclosure
Claude Code (Claude Opus 5.5 (high) ) flagged this while making a core audit. This change was also verified by Codex ( GPT-6.1 sol (xhigh) ).
PR quality check