jupyter / dashboards

[RETIRED] See Voilà as a supported replacement
https://github.com/voila-dashboards
Other
984 stars 210 forks source link

[Q] How to make custom widgets appear via the dashboards server? #275

Closed rs2 closed 7 years ago

rs2 commented 8 years ago

The following snippet works fine in the notebook, but does not render once the notebook is published to the dashboards server:

!pip install qgrid

import qgrid
import pandas as pd

qgrid.nbinstall()

df = pd.DataFrame({'a': range(3)})
qgrid.show_grid(df)
parente commented 8 years ago

Many widget libraries are coded specifically to work in the notebook environment. The dashboard server tries to replicate the notebook environment as much as possible using shims for certain objects that libraries (e.g., matplotlib, plotly, bokeh) expect to appear in the JS namespace. In cases where the widget library wants to serve its own JS as an extension, deeper support is required in the dashboard server. Ideally, this wouldn't be necessary, but it's the status quo today.

My guess is qgrid is expecting something that is not available or its JS is implemented as a notebook extension. If it's not a huge amount of code to support qgrid specifically, we'll certainly take a PR that gets it working through shimming.

rs2 commented 8 years ago

I'm more familiar with what qgrid does, much less so what kernel-gateway/dashboards expect. Which component do I need to debug to figure out what's missing, where do I start?

jhpedemonte commented 8 years ago

The main browser-side code for dashboards_server can be found in dashboard.js and widget-manager.js.

In particular, take a look at these lines in widget-manager.js. These are our current shims for the widget libraries we currently support. qgrid must need something extra.

parente commented 7 years ago

Documenting what @jhpedemonte will be part of the work in the issue linked above just a few minutes ago. We can continue the conversation of what info we need to make available to devs over there.

@rs2 if you did / do get qgrid support working, we can take PRs against the dashboards server repo.