png

To generate a standalone PNG file for a Bokeh application from a single Python script, pass the script name to bokeh png on the command line:

bokeh png app_script.py

The generated PNG will be saved in the current working directory with the name app_script.png.

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

bokeh png app_notebook.ipynb

This will generate an PNG file named app_notebook.png 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 png to generate the PNG:

bokeh png app_dir

It is possible to generate PNG files for multiple applications at once:

bokeh png app_script.py app_dir

For all cases, it’s required to explicitly add a Bokeh layout to bokeh.io.curdoc for it to appear in the output.

class PNG(parser)[source]

Subcommand to output applications as standalone PNG files.

file_contents(args, doc)[source]
invoke(args)[source]
write_file(args, filename, doc)[source]