Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions skore/src/skore/project/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def _repr_html_(self):

def _repr_mimebundle_(self, include=None, exclude=None):
"""Display the interactive plot and controls."""
# Do not use the widget if we're in an IPython terminal
if is_in_ipython_terminal():
return {"text/html": super()._repr_html_()}

self._plot_widget = ModelExplorerWidget(dataframe=self)
return {"text/html": self._plot_widget.display()}

Expand Down Expand Up @@ -200,3 +204,15 @@ def _query_string_selection(self) -> str | None:
query_parts.append("(" + " or ".join(dim_query) + ")")

return " and ".join(query_parts)


def is_in_ipython_terminal():
"""Check whether we're running in an IPython terminal or not."""
try:
# get_ipython is made available in the global namespace when IPython is started
shell = get_ipython()
if shell is None:
return False
return shell.__class__.__name__ == "TerminalInteractiveShell"
except NameError:
return False