We’re proposing a new “develop mode” feature for Bokeh, let us know what you think.

Bokeh is an interactive visualization library. To use it today, you specify some plot(s), typically in Python, and call a function to output them (output_html to generate an HTMLfile, output_server to upload to bokeh-server, or output_notebook to display within iPython Notebook).

If you’re working on fine-tuning a plot — let’s say you want to get the size, colors, labels, and the rest exactly right — your work might involve these steps today:

  1. make a change to your Python script in your text editor, save it
  2. switch to a terminal to re-run the script to generate new HTML
  3. switch over to the browser window and press reload
  4. if it isn’t right, switch back to your text editor and go to step 1

Not that bad, but what if it were even faster?

iPython Notebook can help — but it isn’t necessarily the ideal UI for working on larger scripts and plots, compared to your text editor.

Let’s imagine you open the plot in your browser on one side of the screen, and your text editor on the other side, like this:

It could work like this:

  1. make a change to your Python script in your text editor, save it
  2. the plot in the browser automatically and instantly reloads

When you’re refining a plot (or a page with multiple plots), that’s a lot nicer.

To get here, one step is to decouple two aspects of a Bokeh script; right now the script contains both the “document specification” (describing your plot) and a decision about where to output the plot (output_html, output_notebook, etc.).

A nicer approach might be to describe the plot in the script, but have command line choices about how to output it. To enable this, we’re thinking of a bokeh command that specifies the output target:

  • bokeh run runs a server on localhost that displays your plot
  • bokeh publish myplot.html publishes a static HTML file for the plot
  • bokeh develop runs a server on localhost with features such as automatic reload when your script changes

This last command would be a “development mode” for Bokeh, and it could grow other developer-oriented features over time.

Here’s a demo video of a bokeh develop prototype:

You can find the prototype on a GitHub branch if you’re inclined to dig into the code. We’ll be evolving this code some more, especially to sync up with Bokeh Serverdevelopment plans.

This “choose the output format later” approach makes examples more universal. Right now the Bokeh examples directory contains duplicate examples differing only in their choice of output, here are two scatter plot examples:

There’s no harm in having the option to output plots via API like that, but why make it required? Instead, when someone runs the example they could choose how to output it.

In short, the idea is:

  • Enable choosing the output mode when running a script, so it isn’t necessary to specify it within the script.
  • Add a new output mode which includes development-time-only features such as auto-reload.

If you like this idea or can improve on it, let us know!

About the Author

Q. What is your superpower(s)?

A. Developer

Q. What is your technical specialty or area of research?

A. Currently Bokeh core dev.

Before joining Continuum have been usin …

Read more

Join the Disucssion