html

To generate a standalone HTML page for a Bokeh application from a single Python script, pass the script name to bokeh html on the command line:

bokeh html app_script.py

The generated HTML will be saved in the current working directory with the name app_script.html.

It is also possible to run the same commmand with jupyter notebooks:

bokeh html app_notebook.ipynb

This will generate an HTML file named app_notebook.html just like with a python script.

Applications can also be created from directories. The directory should contain a main.py (and any other helper modules that are required) as well as any additional assets (e.g., theme files). Pass the directory name to bokeh html to generate the HTML:

bokeh html app_dir

It is possible to generate HTML pages for multiple applications at once:

bokeh html app_script.py app_dir

If you would like to automatically open a browser to display the HTML page(s), you can pass the --show option on the command line:

bokeh html app_script.py app_dir --show

This will open two pages, for app_script.html and app_dir.html, respectively.

Warning

Applications that use on_change callbacks require using the Bokeh server to execute the callback code.

class HTML(parser)[source]

Subcommand to output applications as standalone HTML files.

after_write_file(args, filename, doc)[source]
file_contents(args, doc)[source]
extension = 'html'

file extension for output generated by this FileOutputSubcommand

name = 'html'

name for this subcommand