GeezerVison is showing github.com — MNT: Remove internal usage of the 'backend' key in rcParams by timhoffm · Pull Request #32495 · matplotlib/matplotlib
Conversation
timhoffm
commented
Oct 17, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
PR summary
Working towards #31791.
This removes most internal usages of the 'backend' key (some usage in tests is still in place because I have to decide there whether we still want to test the key API).
It's conceptually a schematic replacement
rcParams._get('backend') -> rcParams._backend - obtain raw backend value
x = rcParams['backend'] -> x = rcParams._get_backend_resolved() - obtain resoved backend
rcParams['backend'] = x -> rcParams._set_backend(x) - store the value. Note that this write has no specific logic attatched. It's only be used to store the new backend value. We nevertheless use the class method becuase in some existing contexts we have an rcParams instance, in some we only have the RcParams class. The method can be called on both.
Note: There have been some places writing rcParamsDefault['backend'] and rcParamsOrig['backend']. These were needed to synchronize and persist backend information even after resetting rcParams. That's not needed anymore and thus removed now that the backend information only exists once as class attribute on RcParams.
Note2: In theory it would even be better to use RcParams._backend rather than access via instance rcParams._backend backend. I've not done that for now, because it would complicate the PR. We may do this in a followup.
AI Disclosure
No AI.
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
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
We use an internal helper class method RcParams._set_backend()
to make it easy to set backends in contexts where we do and
do not have an rcParams instance at hand.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.