Skip to content
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

Feature request: display ipywidgets in JupyterLab code console #2370

Closed
cdgreenidge opened this issue Apr 12, 2019 · 12 comments · Fixed by #3004
Closed

Feature request: display ipywidgets in JupyterLab code console #2370

cdgreenidge opened this issue Apr 12, 2019 · 12 comments · Fixed by #3004
Milestone

Comments

@cdgreenidge
Copy link

Would it be possible to display ipywidgets in the JupyterLab code console? Currently, when an ipywidget is evaluated in the code console, it just prints the string representation.

The use case for this is to display interactive plotting widgets from libraries like Plotly during an iPython session (e.g. https://plot.ly/python/jupyter-lab-tools/). The widget versions of the plots are nice because they don't crash with lots of data.

(also at jupyterlab/jupyterlab/issues/6165)

Thank you for your time!

@jasongrout
Copy link
Member

Great idea. It should be somewhat straightforward to do, since the jlab code console basically uses the notebook code, and we already have the display mechanism set up for notebooks.

@jasongrout jasongrout added this to the Minor release milestone Apr 12, 2019
@jasongrout
Copy link
Member

(I won't be able to do this right away. If anyone wants to work on it, comment here and we can get you started.)

@cdgreenidge
Copy link
Author

Great! I don't have a lot of JS experience so I might not work on it myself, but I appreciate it! (@bccho)

@beatrizyumi89
Copy link

I could really use it. I use ipywidget a lot, tend to not upload some things because they look weird.

@danielballan
Copy link

I am getting some traction selling skeptics of the notebook workflow on using the JLab console and/or a paired editor. But the missing interactive plots (Jupyter-matplotlib) are a deal-breaker.

Your comments above, @jasongrout, make me optimistic that this might be within my grasp. I can justify some worktime hours on it. Can you aim me in the right direction?

@jasongrout
Copy link
Member

Your comments above, @jasongrout, make me optimistic that this might be within my grasp. I can justify some worktime hours on it. Can you aim me in the right direction?

Hooray! I think basically following the steps for the notebook (and it may even be easier, since you don't have to render pre-existing widgets, you just need to set up a renderer for new widgets).

It may be as easy as doing essentially this for the console tracker:

if (tracker !== null) {
tracker.forEach(panel => {
registerWidgetManager(
panel.context,
panel.content.rendermime,
chain(
widgetRenderers(panel.content),
outputViews(app, panel.context.path)
)
);
bindUnhandledIOPubMessageSignal(panel);
});
tracker.widgetAdded.connect((sender, panel) => {
registerWidgetManager(
panel.context,
panel.content.rendermime,
chain(
widgetRenderers(panel.content),
outputViews(app, panel.context.path)
)
);
bindUnhandledIOPubMessageSignal(panel);
});
}

@jasongrout
Copy link
Member

That third argument to registerWidgetManager is just what things may have already been rendered that need to be switched to the new widget manager. For a console, that could probably just be an empty list, or even better give it a default of an empty list in the registerWidgetManager function and just delete that third argument.

@jasongrout
Copy link
Member

You might have to fiddle with the typing for the first argument, the context, since it seems to be specific for a notebook right now, but may not need to be.

@reuning
Copy link

reuning commented Sep 21, 2020

Bumping this. As someone who recently started using Jupyter Lab and likes it a lot it would be nice to have this feature. I actually do not like Jupyter Notebook but have so far really liked Jupyter Lab.

@CommonClimate
Copy link

+1 for issue above. I generally think of JupyterLab as "all the things jupyter notebook does and more" but this issue rains on the jlab parade in a significant way.

@fauxneticien
Copy link

+1 to issue. All I really need is tqdm to work (see jupyter/docker-stacks#1715) and am torn because that this alone isn't enough of a reason to switch to notebooks but also am left to sit around waiting for long-running processes...

@lstngr
Copy link

lstngr commented May 10, 2024

+1 for this, I was experimenting with pyvista in a console today (I usually use consoles when trying out new packages or for simple exploratory data analysis) and got the resulting “Loading widget...” message.
It'd be especially helpful for beginners like me to at least have some clear feedback that this behavior is expected (#2764).

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 a pull request may close this issue.

8 participants