To generate standalone SVGs for a Bokeh application from a single Python script, pass the script name to bokeh svg on the command line:
bokeh svg
bokeh svg app_script.py
The generated SVGs will be saved in the current working directory with the name app_script.svg. If there are multiple SVGs within an application, the subsequent ones will be named app_script_1.svg, app_script_2.svg, etc.
app_script.svg
app_script_1.svg
app_script_2.svg
It is also possible to run the same commmand with jupyter notebooks:
bokeh svg app_notebook.ipynb
This will generate SVG files named app_notebook_{n}.svg just like with a python script.
app_notebook_{n}.svg
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 svg to generate the SVG:
main.py
bokeh svg app_dir
It is possible to generate SVG files for multiple applications at once:
bokeh svg 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
SVG
Subcommand to output applications as standalone SVG files.
file_contents
invoke
write_file
extension
file extension for output generated by this FileOutputSubcommand
FileOutputSubcommand
name
name for this subcommand