You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched exisisting GitHub issues to make sure the feature request does not already exist.
Feature details
Currently in ipython, lab_dev objects do not display any useful information in the output. I need to manually call repr to see something useful.
Python 3.11.9 (main, Jul 24 2024, 15:03:44) [GCC 14.1.1 20240522]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.28.0 -- An enhanced Interactive Python. Type '?' for help.
[ins] In [1]: %load playground/display.py
[ins] In [2]: # %load playground/display.py
...: import mrmustard as mm
...: import mrmustard.lab_dev
...:
...: c = mm.lab_dev.Coherent([0], 1)
...:
[ins] In [3]: c
Out[3]: HBox(children=(VBox(children=(HTML(value='\n<style>\ntd {\n border: 1px solid;\n}\nth {\n border: 1px solid;…
Implementation
It would appear that this occurs because there is the _ipython_display_ method defined on the objects. This is described in the ipython code as an "escape-hatch" formatter. After IPython 6.1 the _repr_*_ methods are described as the way to get formatted representations of objects. Perhaps this is the way to do this.
How important would you say this feature is?
1: Not important. Would be nice to have.
Additional information
No response
The text was updated successfully, but these errors were encountered:
To add a bit of context here: I chose to use _ipython_display_ because _repr_*_ requires that you return the required data (eg. raw javascript/html) as opposed to using your own side effect (eg. IPython.display like we use) as described in the ipython docs. I remember that plotly was having trouble when I tried using _repr_html_ and returning the HTML from the widget, likely because it needed some javascript stuff that wasn't installed/supported. I didn't dig too deep, so it might be doable, but Plotly definitely added pain.
Hmm... this would seem to be more complex than it seems due to the way plotly works. Does plotly give equally weird results when used interactively in the terminal interface?
Before posting a feature request
Feature details
Currently in
ipython
, lab_dev objects do not display any useful information in the output. I need to manually callrepr
to see something useful.Implementation
It would appear that this occurs because there is the
_ipython_display_
method defined on the objects. This is described in the ipython code as an "escape-hatch" formatter. After IPython 6.1 the_repr_*_
methods are described as the way to get formatted representations of objects. Perhaps this is the way to do this.How important would you say this feature is?
1: Not important. Would be nice to have.
Additional information
No response
The text was updated successfully, but these errors were encountered: