The resources module provides the Resources class for easily configuring how BokehJS code and CSS resources should be located, loaded, and embedded in Bokeh documents.
Also provides some pre-configured Resources objects.
CDN
load minified BokehJS from CDN
INLINE
provide minified BokehJS from library static directory
Resources
The Resources class encapsulates information relating to loading or embedding Bokeh Javascript and CSS.
mode (str) –
how should Bokeh JS and CSS be included in output
See below for descriptions of available modes
version (str, optional) –
what version of Bokeh JS and CSS to load
Only valid with the 'cdn' mode
'cdn'
root_dir (str, optional) –
root directory for loading Bokeh JS and CSS assets
Only valid with 'relative' and 'relative-dev' modes
'relative'
'relative-dev'
minified (bool, optional) – whether JavaScript and CSS should be minified or not (default: True)
root_url (str, optional) –
URL and port of Bokeh Server to load resources from
Only valid with 'server' and 'server-dev' modes
'server'
'server-dev'
The following mode values are available for configuring a Resource object:
'inline' configure to provide entire Bokeh JS and CSS inline
'inline'
'cdn' configure to load Bokeh JS and CSS from https://cdn.pydata.org
https://cdn.pydata.org
'server' configure to load from a Bokeh Server
'server-dev' same as server but supports non-minified assets
server
'relative' configure to load relative to the given directory
'relative-dev' same as relative but supports non-minified assets
relative
'absolute' configure to load from the installed Bokeh library static directory
'absolute'
'absolute-dev' same as absolute but supports non-minified assets
'absolute-dev'
absolute
Once configured, a Resource object exposes the following public attributes:
js_raw
any raw JS that needs to be placed inside <script> tags
<script>
css_raw
any raw CSS that needs to be places inside <style> tags
<style>
js_files
URLs of any JS files that need to be loaded by <script> tags
css_files
URLs of any CSS files that need to be loaded by <link> tags
<link>
messages
any informational messages concerning this configuration
These attributes are often useful as template parameters when embedding Bokeh plots.
JSResources
The Resources class encapsulates information relating to loading or embedding Bokeh Javascript.
How should Bokeh JS be included in output
what version of Bokeh JS to load
root directory for loading Bokeh JS assets
minified (bool, optional) – whether JavaScript should be minified or not (default: True)
URL and port of Bokeh Server to load resources from (default: None)
If None, absolute URLs based on the default server configuration will be generated.
None
root_url can also be the empty string, in which case relative URLs, e.g., “static/css/bokeh.min.js”, are generated.
root_url
CSSResources
The CSSResources class encapsulates information relating to loading or embedding Bokeh client-side CSS.
how should Bokeh CSS be included in output
what version of Bokeh CSS to load
root directory for loading BokehJS resources
minified (bool, optional) – whether CSS should be minified or not (default: True)
'inline' configure to provide entire BokehJS code and CSS inline
'cdn' configure to load Bokeh CSS from https://cdn.pydata.org
'server-dev' same as server but supports non-minified CSS
'relative-dev' same as relative but supports non-minified CSS
'absolute-dev' same as absolute but supports non-minified CSS