Describe the bug
When using jupyter-book to convert a jupyter notebook with ipywidgets tabs, the tabs are removed in the final html document.
To Reproduce
Steps to reproduce the behavior:
from ipywidgets import widgets
from IPython.display import display
from plotnine import ggplot, aes, geom_bar
from plotnine.data import mpg
conditions = ["class", "drv", "manufacturer"]
tabs_outputs = list()
for current_condition in conditions:
out = widgets.Output(layout={'border': '1px solid black'})
with out:
p = ggplot(mpg) + \
geom_bar(aes(x=current_condition))
display(p)
tabs_outputs.append(out)
tab = widgets.Tab()
tab.children = tabs_outputs
for indx in range(len(conditions)):
tab.set_title(indx, "Condition " + chr(ord("A") + indx))
tab
jupyter-book page ipywidget_tab.ipynb
Expected behavior
When I do the same thing using nbconvert I do see the tabs:
jupyter nbconvert ipywidget_tab.ipynb

But when using jupyter-book the plots appear one after the other but no tabs:

An extra question I have is how can I get rid of the printing of the repr of the ggplot object (red arrow). When using nbconvert I can use a custom jinja2 template where I override {% block stream_stdout %} to get rid of it. How to achieve the same in jupyter-book? also, I need many times to override {% block stream_stderr %} to get rid of warnings in the final report, how to do that? maybe there is a cell tag I can append to do so similar to remove-input etc? (I can do a new issue for this if appropiate)
A link to your book's repository.
Not in a public repo, but attaching here the jupyter notebook and the html directory inside _build. Attaching a text file with the output from running jupyter-book page.
Environment (please complete the following information):
jupyter-book --versionJupyter Book: 0.7.0b5dev0
MyST-NB: 0.8.1
Sphinx Book Theme: 0.0.20
MyST-Parser: 0.8.1
Jupyter-Cache: 0.2.2
Additional context
The example is obviously a minimal one, in a real setting I have lots of plots with typically two nested levels of tabs.
Another thing I have noticed (can create another issue if needed) is that objects of type IPython.display.Markdown are also not rendered correctly, so maybe it is an issue with IPython.display in general?
I think even more than Tabs, all ipywidgets probably don't work right now. I'll mark this as an enhancement rather than a bug and I'll push a commit to the docs to make clear that ipywidgets doesn't yet work. But we definitely wanna improve this one!
thanks!
What about this question (sorry to insist). I can create a new ticket if needed:
An extra question I have is how can I get rid of the printing of the repr of the ggplot object (red arrow). When using nbconvert I can use a custom jinja2 template where I override {% block stream_stdout %} to get rid of it. How to achieve the same in jupyter-book? also, I need many times to override {% block stream_stderr %} to get rid of warnings in the final report, how to do that? maybe there is a cell tag I can append to do so similar to remove-input etc? (I can do a new issue for this if appropiate)
@ofajardo could you open a new issue for that one? It sounds like you'd like to remove warnings in general, is that right?
right, I open a new issue, thanks.
I think even more than
Tabs, all ipywidgets probably don't work right now. I'll mark this as an enhancement rather than a bug and I'll push a commit to the docs to make clear that ipywidgets doesn't yet work. But we definitely wanna improve this one!
Great! We are looking forward to this improvement as we have the same problem @ofajardo describes. What would you say is the ETA for this feature?
It's a bit hard to know the ETA since I'm not exactly sure why they're not working, but the downstream but in nbclient should be fixed in the latest beta, so I think it's a question of figuring this one out in MyST-NB, so hopefully soon
Thank you @choldgraf. Will this fix affect also the JB 1.0 version that we are using or should we update to the 2.0?
I think that this will be fixed once https://github.com/executablebooks/MyST-NB/pull/193 is merged 馃憤
@choldgraf Thanks for solving it so quickly! It works and it looks beautiful!
wohoo!