Set mica.report.report.main matplotlib backend to Agg #317
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.
Description
Set the matplotlib backend to Agg in mica.report.report.main()
This is meant to be run non-interactively. It is generally called from scripts/update_reports.py which explicitly sets the backend to Agg, but if one needs to manually run reports, it would be a defect for it to not have the non-interactive backend set. It also looks like for 2025.x that the test to write reports would fail trying to run with the interactive backend in a headless test env.
I could have fixed the test by just setting the backend for the test, but it seemed a bug in general for the code to try to use the interactive backend in general to make mica html reports.
Interface impacts
I think this would leave the backend set as Agg for downstream code if mica.report.report.main was run before other codes as I made no attempt to put this in a closure and retain the original backend state after reports are made. Given how the reporting is used, this seems non-impacting, but could be reevaluated if it becomes an issue.
Testing
Tested in 2025.0rc5
Unit tests
Independent check of unit tests by [REVIEWER NAME]
Functional tests
No functional testing.