Skip to content

Type kwargs as Any in plt.show - #32460

Merged
scottshambaugh merged 1 commit into
matplotlib:mainfrom
vnmabus:patch-2
Oct 11, 2026
Merged

scottshambaugh merged 1 commit into
matplotlib:mainfrom
vnmabus:patch-2

Conversation

@vnmabus

@vnmabus vnmabus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

PR summary

This should prevent Pyright from raising "partially unknown" errors on calls to plt.show, as explained in #27030. This is particularly annoying when writing Jupyter notebooks in Python format, which usually have many calls to plt.show.

AI Disclosure

No AI was used.

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • New and changed code is tested
  • [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

This should prevent Pyright from raising "partially unknown" errors on calls to `plt.show`, as explained in matplotlib#27030. This is particularly annoying when writing Jupyter notebooks in Python format, which usually have many calls to `plt.show`.

@iccir iccir 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.

This looks fine to me for now, although I believe the plan is to eventually use TypedDicts.

@vnmabus

vnmabus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

This looks fine to me for now, although I believe the plan is to eventually use TypedDicts.

Anything that works is fine to me, but kwargs need to be typed somehow, in order to not give spurious errors with Pyright in packages using Matplotlib. plt.show is not the only case, although perhaps one of the most annoying ones.

@scottshambaugh
scottshambaugh merged commit e3fc0da into matplotlib:main Oct 11, 2026
38 of 41 checks passed
@QuLogic QuLogic added this to the v3.12.0 milestone Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants