Skip to content

Conversation

@timhoffm
Copy link
Member

@timhoffm timhoffm commented Jan 14, 2026

since 3.10 we have the official API matplotlib.get_backend (auto_select=False). No problems have been reported and matplotlib-inline is using it. Therefore, I remove the provisional status from the auto-select flag.

Additionally, I deprecate the API rcParams._get('backend'), which the above is replacing.

It seems that rcParams._get("backend") is not used anywhere publically, but let's still be defensive and deprecate.

https://github.com/search?q=%2F%5C._get%5C%28%5B%22%27%5Dbackend%5B%22%27%5D%5C%29%2F+language%3APython+NOT+is%3Afork+NOT+path%3A**%2Fmatplotlib%2F**+NOT+path%3A**%2Fsite-packages**+NOT+path%3A**%2Fpyplot.py&type=code

This is working towards removal of dynamic backend state from rcParams #26406.
Follow-up to #29039.

@timhoffm timhoffm force-pushed the deprecate-_get_backend branch from f343d24 to 7e92025 Compare January 14, 2026 09:42
@timhoffm timhoffm added this to the v3.11.0 milestone Jan 14, 2026
since 3.10 we have the official API `matplotlib.get_backend
(auto_select=False)`. No problems have been reported and
matplotlib-inline is using it https://github
.com/ipython/matplotlib-inline/pull/38. Therefore, I remove the
provisional status from the auto-select flag.

Additionally, I deprecate the API rcParams._get('backend'), which the
above is replacing.

It seems that `rcParams._get("backend")` is not used anywhere
publically, but let's still be defensive and deprecate.

https://github.com/search?q=%2F%5C._get%5C%28%5B%22%27%5Dbackend%5B%22%27%5D%5C%29%2F+language%3APython+NOT+is%3Afork+NOT+path%3A**%2Fmatplotlib%2F**+NOT+path%3A**%2Fsite-packages**+NOT+path%3A**%2Fpyplot.py&type=code

This is working towards matplotlib#26406.
Follow-up to matplotlib#29039.
@timhoffm timhoffm force-pushed the deprecate-_get_backend branch from 7e92025 to fc8fb3a Compare January 14, 2026 12:22
@timhoffm timhoffm marked this pull request as draft January 14, 2026 13:23
@timhoffm
Copy link
Member Author

Still need to filter the deprecation warnings for internal use.

Comment on lines +716 to +720
_api.warn_deprecated(
"rcParams._get('backend') is deprecated since Matplotlib 3.11. "
"Use matplotlib.get_backend(auto_select=False) instead, which is "
"available since Matplotlib 3.10.",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first arg is since, not the full message.

Suggested change
_api.warn_deprecated(
"rcParams._get('backend') is deprecated since Matplotlib 3.11. "
"Use matplotlib.get_backend(auto_select=False) instead, which is "
"available since Matplotlib 3.10.",
)
_api.warn_deprecated(
"3.11",
name="rcParams._get('backend')",
addendum="Use matplotlib.get_backend(auto_select=False) instead, which is "
"available since Matplotlib 3.10.",
)

"Use matplotlib.get_backend(auto_select=False) instead, which is "
"available since Matplotlib 3.10.",
)
# TODO: When removing this, also remove the suppression context in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "this"? The comment is in an odd spot to decide if it's the if, the warning, or the whole method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants