bokeh.command.util#
Provide utility functions for implementing the bokeh command.
- build_single_handler_application(path: str, argv: list[str] | None = None) Application[source]#
- Return a Bokeh application built using a single handler for a script, notebook, or directory. - In general a Bokeh - Applicationmay have any number of handlers to initialize- Documentobjects for new client sessions. However, in many cases only a single handler is needed. This function examines the- pathprovided, and returns an- Applicationinitialized with one of the following handlers:- ScriptHandlerwhen- pathis to a- .pyscript.
- NotebookHandlerwhen- pathis to an- .ipynbJupyter notebook.
- DirectoryHandlerwhen- pathis to a directory containing a- main.pyscript.
 - Parameters:
- Returns:
- Raises:
 - Notes - If - pathends with a file- main.pythen a warning will be printed regarding running directory-style apps by passing the directory instead.
- build_single_handler_applications(paths: list[str], argvs: dict[str, list[str]] | None = None) dict[str, Application][source]#
- Return a dictionary mapping routes to Bokeh applications built using single handlers, for specified files or directories. - This function iterates over - pathsand- argvsand calls- build_single_handler_application()on each to generate the mapping.
- die(message: str, status: int = 1) Never[source]#
- Print an error message and exit. - This function will call - sys.exitwith the given- statusand the process will terminate.
- report_server_init_errors(address: str | None = None, port: int | None = None, **kwargs: str) Iterator[None][source]#
- A context manager to help print more informative error messages when a - Servercannot be started due to a network problem.- Parameters:
 - Example - with report_server_init_errors(**server_kwargs): server = Server(applications, **server_kwargs) - If there are any errors (e.g. port or address in already in use) then a critical error will be logged and the process will terminate with a call to - sys.exit(1)