Skip to content

Conversation

@scott-huberty
Copy link
Contributor

As seen in The failing ubuntu-latest job of #13145

FAILED mne/viz/backends/tests/test_abstract.py::test_widget_abstraction_notebook[notebook] - nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
"""Test the GUI widgets abstraction in notebook."""
from pathlib import Path

from IPython import get_ipython

from mne.viz import set_3d_backend
from mne.viz.backends.renderer import _get_backend
from mne.viz.backends.tests.test_abstract import _do_widget_tests

set_3d_backend("notebook")
backend = _get_backend()
assert Path(backend.__file__).stem == "_notebook"

ipython = get_ipython()
ipython.magic("%matplotlib widget")
_do_widget_tests(backend)
------------------

----- stdout -----
Using notebook 3d backend.
------------------

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 15
     12 assert Path(backend.__file__).stem == "_notebook"
     14 ipython = get_ipython()
---> 15 ipython.magic("%matplotlib widget")
     16 _do_widget_tests(backend)

AttributeError: 'ZMQInteractiveShell' object has no attribute 'magic'

From what I can gather, the .magic method is deprecated ( ref ), and this may be why test_widget_abstraction_notebook is failing with the latest IPython (9.0.1)

I can't replicate the CI failure locally on my Mac, but here I am replacing .magic with run_line_magic, which seems to be the recommended way? Opening this PR to see if it fixes it..

- As seen in The failing ubuntu-latest job of mne-tools#13145

https://github.com/mne-tools/mne-python/actions/runs/13702975846/job/38321283000?pr=13145#step:16:5679

I cannot replicate this locally on my MacOS, but from what I can gather, the .magic method is deprecated (ref ipython/ipython#10327 ), and so test_widget_abstraction_notebook fails with the lastest IPython (9.0.1)

Let's try to use run_line_magic instead, which seems to be the recommended way
Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1 for merge once it comes back green

@scott-huberty scott-huberty changed the title WIP: Fixes for Latest IPython (9.0.1) FIX: Fixes for Latest IPython (9.0.1) Mar 6, 2025
@larsoner larsoner enabled auto-merge (squash) March 6, 2025 18:42
auto-merge was automatically disabled March 6, 2025 19:29

Head branch was pushed to by a user without write access

@drammock drammock merged commit e7a593a into mne-tools:main Mar 6, 2025
31 of 32 checks passed
@scott-huberty scott-huberty deleted the ipython_9 branch March 6, 2025 20:56
larsoner added a commit to larsoner/mne-python that referenced this pull request Apr 4, 2025
* upstream/main: (149 commits)
  FIX make_watershed_bem to handle missing talairach_with_skull.lta courtesy Freesurfer 8 (mne-tools#13172)
  ENH: Add upsampling for MEG helmet surface (mne-tools#13179)
  MAINT: Update code credit (mne-tools#13180)
  BUG: Fix bug with least-squares sphere fit (mne-tools#13178)
  fix EDF export (mne-tools#13174)
  fix typo (mne-tools#13171)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13164)
  Fix dev installation guide (mne-tools#13163)
  expose 'mode' for plotting dipole on brain (mne-tools#13162)
  turn dipole attrs into properties (mne-tools#13153)
  remove misformatted (and unused) crossref anchor (mne-tools#13155)
  doc: point to read_dipole (mne-tools#13149)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13152)
  BUG: Fix bug with not short-circuiting n_jobs=1 (mne-tools#13147)
  FIX: Missing coordinates.xml in MFF file (mne-tools#13148)
  FIX: Gracefully handle bad XML files in EGI reader (mne-tools#13145)
  Fixes for Latest IPython (9.0.1) (mne-tools#13146)
  Fix intersphinx (mne-tools#13143)
  BUG: Fix bug with parallel doc build (mne-tools#13140)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13141)
  ...
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.

3 participants