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

adding widgets? #339

Closed
hhuuggoo opened this issue Feb 10, 2014 · 7 comments

Comments

@hhuuggoo
Copy link
Contributor

commented Feb 10, 2014

I'm going to start working on this this week to support some of the demos we have coming up. So comments from @bryevdv @pzwang @paddymul, @mattpap and @damianavila on this as early as possible would be helpful

Widgets

We need widgets in Bokeh. These widgets need the following capabilities

  • Compatible with the IPython notebook.
    • Ideally one can use the same python command that constructs
      a widget in the IPython notebook, and use the same command in
      Bokeh, and it will also work OUTSIDE the IPython notebook.
      We probably achieve this by extending the IPython classes.
    • At a minimum, Bokeh widgets should work inside IPython Notebook
      even if the syntax for construction is different
  • Support custom code, both javascript and python. This means we need
    the capabilities to plug in new python classes into the Bokeh Server,
    as well as add new classes on the javascript side.
  • Support custom interaction. We should be able to hook up
    custom behavior ALL in python. We can already hook up custom
    behavior all in javascript

Proposal

  • pluggable python system: The bokeh server code
    is modified to accept a module. All PlotObjects imported by that module
    are pulled into the Bokeh Server
  • pluggable javascript. The bokeh server code is modified to accept
    a directory of javascript, these get loaded into all Bokeh plotting pages.
    These javascript files will register themselves with our collections object.
  • ViewModel system which allows writing custom interactions without writing
    any javascript code.
  • Case Study: Build a UI, where there is a select box with a list of stocks
    choosing a ticker in the selector constructs a plot of that security.
    • Write the following classes:
      • JS: HBox, HBoxView, Python: HBox
      • JS: SelectBox, SelectBoxView, Python: SelectBox
      • custom Python object, Controller, which is loaded in via custom python file
  • Create an instance of an HBox with an instance of SelectBox, and a instance of
    Plot inside it. Create an instance of a Controller. Populate the SelectBox with a list of tickers that we have Setup events on the Controller to listen to changes on the SelectBox, and modify the data url of the Plot. We currently have the capability of saving callbacks on the Python side, so that's how this event binding would work
@damianavila

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2014

Just for reference, I am linking relevant info about the widget system in IPython:

IPEP 23: https://github.com/ipython/ipython/wiki/IPEP-23%3A-Backbone.js-Widgets
PR implementing IPEP 23 (with interesting discussions): ipython/ipython#4374
Examples: http://nbviewer.ipython.org/github/ipython/ipython/blob/master/examples/widgets/index.ipynb?create=1

@bryevdv

This comment has been minimized.

Copy link
Member

commented Feb 12, 2014

@damianavila just for some context, one thing that worries us about IPython widgets is that we absolutely have to have widgets that work independently of IPython. Unless IPython is planning to offer their widgets as a library that can be used-standalone, that would mean supporting two "widget backends". I think we have to start with the general case (that works anywhere, including the notebook) first, using dojo or something similar, and then possible add IPython widgets as a special case later.

@damianavila

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2014

AFAIK, I don't see the IPython widgets as an independent library soon. Some people from SAGE Cell Server project are actively working in the widget stuff, but I think they are using all the IPython under the hood. Your worries are probably justified, I think...

@pzwang

This comment has been minimized.

Copy link

commented Feb 12, 2014

I'm here at Strata with brian and fernando, will try to chat with them about this to make sure we don't duplicate work where unnecessary, and that they understand what our needs are and that we understand their needs.

@paddymul

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2014

Keep in mind that it will be easier to integrate bokehJS in apps if it
doesn't have to pull in a bunch of IPython stuff. We have enough
trouble packaging our own JS system, pulling the current js work from
IPython would be difficult.

Wait what type of widgets are we talking about? I'm thinking of
frontend widgets which interact with bokeh plots.

Integrating with what IPython is doing makes sense if you want to
include python, but it makes integrations into non-complete bokeh stack
environments cumbersome.

On 2/12/14, 8:33 AM, pzwang wrote:

I'm here at Strata with brian and fernando, will try to chat with them
about this to make sure we don't duplicate work where unnecessary, and
that they understand what our needs are and that we understand their
needs.


Reply to this email directly or view it on GitHub
#339 (comment).

@hhuuggoo

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2014

I think the goal would be that our python classes extend their widget objects, but our JS widgets which mirror them would be independent implementations

@bryevdv

This comment has been minimized.

Copy link
Member

commented Feb 12, 2014

@hhuuggoo That is my thoughts on how this should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.