Skip to content

fix(skore): Update project summary not to rely on IPython.display.display(), but use widgets and their _repr_mimebundle_ instead.#2150

Open
FrancoisPgm wants to merge 3 commits intoprobabl-ai:mainfrom
FrancoisPgm:no_display_summary_widget
Open

fix(skore): Update project summary not to rely on IPython.display.display(), but use widgets and their _repr_mimebundle_ instead.#2150
FrancoisPgm wants to merge 3 commits intoprobabl-ai:mainfrom
FrancoisPgm:no_display_summary_widget

Conversation

@FrancoisPgm
Copy link
Contributor

An alternative way to fix #2070.

It appears that the root cause of the issues with Summary's __repr__ is the fact that ModelExplorerWidget uses the IPython.display.display function to display its html. As far as I understand, this functions is similar to a print statement in that it sends the html to the stdout when it is called. When that's at the end of a jupyter notebook cell, it get handled properly, but in other cases it can create side effects, like showing the html code in an IPython terminal (#2070) or showing the widget twice in colab notebooks because the function was called once again (#2039).

Therefore a possible approach to solve this issue is to avoid relying on IPython.display.display to show the widget, instead building it with IPython widget objects and using their _repr_mimebundle_ methods instead to let IPython manage the displaying.

This PR is an attempt at such a refactor.

In its current state it entails a few drawbacks:

  • we lose the workaround that allowed to have the width of the summary's plot match the width of the cell, as it was done by calling fig.layout.autosize = True after calling display().
  • the Summary widget breaks in google colab notebooks as they use an older version of IPywidgets that does not implement _repr_mimebundle_.
  • there is one test that I did not manage to adapt, as I don't fully understand it, a check that assert widget.current_fig is None

@thomass-dev
Copy link
Collaborator

thomass-dev commented Nov 13, 2025

the Summary widget breaks in google colab notebooks as they use an older version of IPywidgets that does not implement repr_mimebundle.

IMO, that's a sensitive issue. If we can't find a solution, i'd rather do nothing, leave things as they are, so that at least all the notebooks work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(skore/Summary): Let pandas calculates the representation in a simple context (script/IPython)

2 participants