Search code examples
pythonhtmlbokehoffline

Generating Bokeh html files that work offline


In the past it seems bokeh had options to generate html files that work offline. Here is an older discussion that shows how to do it: https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/Ts2P24YR0VU

using the line:

output_file(file_path, mode='inline') 

However, this seem not to work with the bokeh version I am using 0.12.10

When I try adding mode = 'inline' I am getting:

TypeError: file_html() got an unexpected keyword argument 'mode'

Looking at the new dcumentaion it makes sense: https://docs.bokeh.org/en/latest/docs/reference/embed.html#bokeh.embed.file_html

Is it possible to get a short example of what to do to allow the html files to be viewed offline without running a local bokeh server?

Hopefully the solution is trivial as before.

Jacob


Solution

  • The file_html function accepts a resources parameter, which must be an actual Resources object (not a string). For convenience, there are some pre-configured resource objects. In particular, the bokeh.resources.INLINE object can be passed to file_html to use inline resources.