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
bokeh png app_script.py
The generated PNG will be saved in the current working directory with the name app_script.png.
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.
app_notebook.png
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:
main.py
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.
bokeh.io.curdoc
PNG
Subcommand to output applications as standalone PNG files.
file_contents
invoke
write_file
extension
file extension for output generated by this FileOutputSubcommand
FileOutputSubcommand
name
name for this subcommand