Open kcrisman opened 5 years ago
Description changed:
I should note that the implementation of @interact
itself is really done by upstream. Three packages (all under the Jupyter umbrella) play an important role:
interact
object is defined.There are Sage customizations to the standard @interact
(see src/sage/repl/ipython_kernel/interact.py
), but those do not fundamentally change the way how interacts work.
So either we need to fix something upstream, or we add a workaround in Sage, or we become happy with the status-quo.
- ipywidgets: Python package dealing with widgets and where the actual
interact
object is defined.- widgetsnbextension: JavaScript code for working with widgets in the browser.
- traitlets: low-level Python library dealing with the callback mechanism (changing the value of a widget triggers evaluation of the interact function).
Which of these is the one that is most likely to be causing the immediate change with regard to the text boxes? I think the real problem is that different implementations work differently, and it surprises me that there is such immediate response in Jupyter - you'd think it would be "easier" not to poll the Sage kernel with more computation so often, but of course I don't know much about the specific technicalities.
Replying to @kcrisman:
Which of these is the one that is most likely to be causing the immediate change with regard to the text boxes?
It's really a combination, that's why I mentioned the various packages: whenever the user types something in a text box, widgetsnbextension
sends an event to the Jupyter kernel. ipywidgets
then changes the .value
attribute of the text box. traitlets
notices that this attribute has changed and calls a callback function for the interact (implemented by ipywidgets
). This callback then updates the interact.
Changed keywords from none to jupyter
Moving open critical and blocker issues to the next release milestone (optimistically).
Ticket retargeted after milestone closed
Moving to 9.4, as 9.3 has been released.
In #27735 it was discovered that, unlike sagenb or Sage cell, text input in
@
interacts in Jupyter apparently immediately re-evaluate even before 'enter' is pressed. jdemeyer explains:However, because this is different from the behavior of other interact implementations (does anyone know about .sagews CoCalc sheets?), probably this should be fixed. Among other things, if the interact involves significant computation time (> 1 ms, especially a problem with anything involving graphics), it can slow down usage of interacts dramatically, which sort of defeats the purpose of
@
interacts.CC: @jdemeyer @slel @vinklein @zerline
Component: notebook
Keywords: jupyter
Issue created by migration from https://trac.sagemath.org/ticket/27752