要从单个Python脚本生成Bokeh应用程序的序列化JSON表示,请将脚本名称传递给 bokeh json 在命令行上:
bokeh json
bokeh json app_script.py
生成的JSON将以名称保存在当前工作目录中 app_script.json .
app_script.json
也可以从目录创建应用程序。目录应包含 main.py (以及所需的任何其他助手模块)以及任何附加资产(例如,主题文件)。将目录名传递给 bokeh json 要生成JSON:
main.py
bokeh json app_dir
默认情况下,生成的JSON作为一行输出,没有缩进。要在多行上生成“pretty printed”JSON,可以使用 --indent 论点:
--indent
bokeh json app_script.py --indent=2
JSON
子命令将应用程序输出为序列化的JSON
file_contents
extension
由此扩展名生成的文件 FileOutputSubcommand
FileOutputSubcommand
name
此子命令的名称