Add Report.save(only_if_changed=True) - #14261
Merged
Merged
Conversation
larsoner
force-pushed
the
report-unsaved-changes
branch
from
September 1, 2026 15:35
81cf616 to
e7d5c6a
Compare
drammock
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Sometimes in my scripts reports are opened with a context manager in case I need to add anything, but then in the context manager I don't change anything. It would be nice if MNE-Python was smart enough in that case not to actually write anything out. This PR adds that! Changes drafted with Claude Opus 5 and reviewed by me.
Wasn't 100% sure if
report.unsaved_changesshould be public or private, but the cost to making it public is low and it seems like it could be useful sometimes. And I figure an explicitonly_if_changed=Truewas a reasonable way to allow people to force a write by passingFalseif they really want to for some reason.