-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Output widget at nbconvert level for interact #91
Implement Output widget at nbconvert level for interact #91
Conversation
While testing found a bug in ipywidgets: display_id in the Output widget is not supported yet, and we could do a refactor to do code deduplication with nbconvert's ExecutePreprocessor. To perform testing we need to use jupyter/nbconvert#900, coverage for execute.py is 100%. |
c84ac49
to
6a51fad
Compare
Could you provide an example? Using from ipywidgets import interact
def foo(x):
print(x)
interact(foo, x=(0, 10)) yields as output only
without the slider. |
@enryH this appears to work. Are you talking about voila or nbconvert? |
voila. I did not pay attention and another package set the |
This is a port of voila-dashboards/voila#91 and subsequent fixes.
This is a port of voila-dashboards/voila#91 and subsequent fixes.
This is a port of voila-dashboards/voila#91 and subsequent fixes.
As mentioned in #19 and #85 there are some issues with interact. Interact(ion) uses the Output widget a lot, which relies on the frontend to handle display and clear_output differently.
A part of the fix is in jupyter/nbconvert#969 which deals with
wait=True
, but this only solves part of the issue.When nbconvert is used to execute the notebook, there is no OutputWidget that can hook into the display mechanism to redirect display and clear_output calls. This custom executor creates a 'fake' Output widget that mirrors this behaviour.
This is to show that it is possible to support interact with voila, I am not sure this is the best solution. Other solution are:
I think the core problem is that interact(ion) relies on the Output widget being connected to the frontend. We could solve some problems by actually modifying
Output.ouputs
at the kernel side, and never invoke display/clear_output, but directly invoke methods on the Output widget.If we want to go forward with this approach (which would be the most compatible one), this requires a few more tweaks and a few tests (wait=True for the output widget it no supported)