Skip to content

FIX: interpolate the path and name MPLCONFIGDIR in the temp cache dir warning - #32252

Open
rokokol wants to merge 1 commit into
matplotlib:mainfrom
rokokol:fix-mplconfigdir-warning
Open

FIX: interpolate the path and name MPLCONFIGDIR in the temp cache dir warning#32252
rokokol wants to merge 1 commit into
matplotlib:mainfrom
rokokol:fix-mplconfigdir-warning

Conversation

@rokokol

@rokokol rokokol commented Aug 28, 2026

Copy link
Copy Markdown

PR summary

When Matplotlib falls back to a temporary cache directory, the warning has two problems (discussed in #32246):

  1. Since Added handling for undetermined home directory #30454 it prints a literal {configdir}: the message text was refactored into the issue_msg variable and lost its f prefix on the way. The regression ships in releases since 3.11.0.
  2. When MPLCONFIGDIR is set explicitly, the message still blames "the default path", pointing the reader away from the variable they set.

This PR restores the interpolation and names MPLCONFIGDIR in the message when it is the source of the path. test_tmpconfigdir_warning now also asserts that the resolved path appears in the warning — the strengthened test fails against current main and passes with the fix.

The behavioral half of #32246 (honoring a read-only cache dir) is left for a separate PR per the discussion there.

AI Disclosure

AI-assisted: I used Claude (Anthropic) to help analyze the code paths and draft the patch, tests and text. I reviewed and understand every change, and verified the behavior myself: the strengthened test fails against current main (it prints the literal {configdir}) and passes with the fix.

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

@github-actions

Copy link
Copy Markdown

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process.

You can also join us on discourse chat for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

The warning announcing the fallback to a temporary cache directory
lost its f-prefix when the message was refactored in matplotlib#30454, so it
prints a literal "{configdir}".  Restore the interpolation, and when
MPLCONFIGDIR is set explicitly, name the variable instead of blaming
"the default path" the user never touched.

Strengthen test_tmpconfigdir_warning to assert that the resolved path
appears in the warning; the strengthened test fails on the unfixed
code.
@rokokol
rokokol force-pushed the fix-mplconfigdir-warning branch from 282f76e to 6bd17d5 Compare August 28, 2026 10:57
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.

1 participant