Skip to content

Commit 1ad3d07

Browse files
rwestclaude
andcommitted
Modernize display.py IPython detection
Replace deprecated InteractiveShell.initialized() with get_ipython(), the canonical way to detect an active IPython/Jupyter session. Also update the docstring to drop the legacy --pylab reference. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 86d2f66 commit 1ad3d07

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

rmgpy/display.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@
2929

3030
"""
3131
This module contains only a display() function, which, if you are running in
32-
the IPython --pylab mode, will render things inline in pretty SVG or PNG graphics.
33-
If you are NOT running in IPython --pylab mode, it will do nothing.
32+
a Jupyter notebook or IPython session, will render things inline in pretty SVG or PNG graphics.
33+
If you are NOT running in such an environment, it will do nothing.
3434
"""
3535

3636
try:
37-
from IPython.core.interactiveshell import InteractiveShell
37+
from IPython import get_ipython
38+
_ipython = get_ipython()
3839
except ImportError:
40+
_ipython = None
41+
42+
if _ipython is not None:
43+
from IPython.display import display
44+
else:
3945
def display(obj):
4046
pass
41-
else:
42-
if InteractiveShell.initialized():
43-
from IPython.core.display import display
44-
else:
45-
def display(obj):
46-
pass

0 commit comments

Comments
 (0)