GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BLD: Install the type stub for backends.registry by maaz7409 · Pull Request #32481 · matplotlib/matplotlib

Conversation

@maaz7409

@maaz7409 maaz7409 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

PR summary

lib/matplotlib/backends/registry.pyi was added in 3.9 (#27719) but is not
listed in typing_sources in lib/matplotlib/backends/meson.build, so it
has never been installed. Wheels from 3.9.0 to 3.11.2 ship registry.py
without it.

Because py.typed is installed, type checkers read the unannotated
registry.py instead. They still know that backend_registry is a
BackendRegistry, but all its methods are untyped. With mypy on an
installed wheel:

from matplotlib.backends.registry import BackendFilter, backend_registry

reveal_type(backend_registry.list_builtin(BackendFilter.INTERACTIVE))
# before: Any    after: list[str]
reveal_type(backend_registry.resolve_gui_or_backend("qt"))
# before: Any    after: tuple[str, str | None]

Under mypy --strict, each of these calls is currently a
no-untyped-call error.

This PR adds the file to the list. A wheel built with the change has
registry.pyi as its only new file, and stubtest reports no differences
between the stub and the runtime module. I ran it without the allowlist,
because ci/mypy-stubtest-allowlist.txt skips everything under
matplotlib.backends.

The two other uninstalled stubs are left out on purpose:

  • a) backends/backend_pdf.pyi has annotation errors that would reject valid
    code once installed, e.g. PdfPages.savefig(fig, dpi=300). I'll fix and
    install it in a follow-up PR.
  • b) dates.pyi covers only the module's functions, so installing it would make
    from matplotlib.dates import DateFormatter a type error. It can be added
    once 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

  • Use an expressive title, e.g. "Fix title font property precedence"
  • [N/A] New and changed code is tested (install list only; checked by building a wheel)
  • [N/A] Plotting related features are demonstrated in an example
  • [N/A] New features and API changes have release notes
  • [N/A] Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@maaz7409
BLD: Install the type stub for backends.registry
b6734e9
QuLogic
QuLogic approved these changes Oct 16, 2026
View reviewed changes
@QuLogic QuLogic added the topic: typing label Oct 16, 2026
@QuLogic QuLogic added this to the v3.11.3 milestone Oct 16, 2026
@ksunden
ksunden merged commit 6c628b9 into matplotlib:main Oct 16, 2026
46 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@meeseeksmachine meeseeksmachine mentioned this pull request Oct 16, 2026
Backport PR #32481 on branch v3.11.x (BLD: Install the type stub for backends.registry) #32485
Merged
iccir pushed a commit that referenced this pull request Oct 16, 2026
@ksunden @meeseeksmachine
Backport PR #32481: BLD: Install the type stub for backends.registry
b2ea1b3
iccir added a commit that referenced this pull request Oct 16, 2026
@iccir
Merge pull request #32485 from meeseeksmachine/auto-backport-of-pr-32…
a52157c
…481-on-v3.11.x

Backport PR #32481 on branch v3.11.x (BLD: Install the type stub for backends.registry)
@maaz7409 maaz7409 mentioned this pull request Nov 9, 2026
TYP,BLD: Fix backend_pdf stub errors and install it #32586
Open
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@QuLogic QuLogic QuLogic approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic: typing

Projects

None yet

Milestone

v3.11.3

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@maaz7409 @QuLogic @ksunden
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.