Stop adiftools import from overriding notebook matplotlib backend#14
Merged
Stop adiftools import from overriding notebook matplotlib backend#14
Conversation
Agent-Logs-Url: https://github.com/JS2IIU-MH/adiftools-dev/sessions/16d535a8-1297-4bbf-8e18-ebb0929af222 Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JS2IIU-MH/adiftools-dev/sessions/16d535a8-1297-4bbf-8e18-ebb0929af222 Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JS2IIU-MH/adiftools-dev/sessions/16d535a8-1297-4bbf-8e18-ebb0929af222 Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JS2IIU-MH/adiftools-dev/sessions/16d535a8-1297-4bbf-8e18-ebb0929af222 Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JS2IIU-MH/adiftools-dev/sessions/16d535a8-1297-4bbf-8e18-ebb0929af222 Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix notebook plotting issue when importing adiftools
Stop adiftools import from overriding notebook matplotlib backend
May 5, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes an import-time matplotlib side effect from adiftools.adifgraph so importing the library no longer forces the global backend to Agg, which preserves inline plotting behavior in notebook environments.
Changes:
- Removed the import-time
matplotlib.use('Agg')call and the now-unusedmatplotlibimport fromadiftools/adifgraph.py. - Added a regression test that reloads
adifgraphand asserts it does not callmatplotlib.use. - Kept the change narrowly scoped to backend side effects and their coverage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
adiftools/adifgraph.py |
Removes the module-level backend override that was mutating matplotlib state during import. |
tests/test_adifgraph.py |
Adds a regression test verifying adifgraph import/reload no longer invokes matplotlib.use. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Importing
adiftools.adiftoolsin Kaggle/Jupyter disabled inline plotting becauseadifgraphchanged matplotlib’s global backend toAggat import time. This PR removes that import side effect so notebook plotting remains functional after importing the library.Backend behavior
adiftools/adifgraph.py:matplotlib.use('Agg')import matplotlibadiftoolsno longer mutates global matplotlib backend during import.Regression coverage
tests/test_adifgraph.pyto assertadifgraphimport does not callmatplotlib.use.