matplotlib / matplotlib/ipympl
ipympl changes MPL backend on import
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 1.7k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
- xref: https://github.com/mne-tools/mne-python/pull/13963#pullrequestreview-4499976618
In mne-python (see above), we have a functionality called `sys_info`, which gives us (among other things) the versions of all sorts of installed packages.
For this reason, we also import ipympl.
At import time, ipympl actually **changes** the MPL backend.
Is this something that could be avoided? This change in backend was very surprising to us and it took an in-depth profiling to identify it as the cause of a massive memory leak in a pipeline that produced several plots on each iteration, never closing them due to the backend change.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the import-time behavior described in the issue and the linked mne-python pull request review, focusing on where importing ipympl changes the Matplotlib backend. Reproduce this with the sys_info-style import sequence and verify that importing ipympl no longer changes the backend or causes the reported plot-lifecycle problem.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, matplotlib, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100