svg

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 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.

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.

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:

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.

class SVG(parser)[source]

Subcommand to output applications as standalone SVG files.

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