bokeh.resources¶
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
-
class
Resources
(mode=None, version=None, root_dir=None, minified=None, log_level=None, root_url=None, path_versioner=None, components=None)[source]¶ The Resources class encapsulates information relating to loading or embedding Bokeh Javascript and CSS.
- Parameters
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'
moderoot_dir (str, optional) –
root directory for loading Bokeh JS and CSS assets
Only valid with
'relative'
and'relative-dev'
modesminified (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
The following mode values are available for configuring a Resource object:
'inline'
configure to provide entire Bokeh JS and CSS inline'cdn'
configure to load Bokeh JS and CSS fromhttp://cdn.pydata.org
'server'
configure to load from a Bokeh Server'server-dev'
same asserver
but supports non-minified assets'relative'
configure to load relative to the given directory'relative-dev'
same asrelative
but supports non-minified assets'absolute'
configure to load from the installed Bokeh library static directory'absolute-dev'
same asabsolute
but supports non-minified assets
Once configured, a Resource object exposes the following public attributes:
-
js_raw
¶ any raw JS that needs to be placed inside
<script>
tags
-
css_raw
¶ any raw CSS that needs to be places inside
<style>
tags
-
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
-
messages
¶ any informational messages concerning this configuration
These attributes are often useful as template parameters when embedding Bokeh plots.
-
class
JSResources
(mode=None, version=None, root_dir=None, minified=None, log_level=None, root_url=None, path_versioner=None, components=None)[source]¶ The Resources class encapsulates information relating to loading or embedding Bokeh Javascript.
- Parameters
mode (str) –
How should Bokeh JS be included in output
See below for descriptions of available modes
version (str, optional) –
what version of Bokeh JS to load
Only valid with the
'cdn'
moderoot_dir (str, optional) –
root directory for loading Bokeh JS assets
Only valid with
'relative'
and'relative-dev'
modesminified (bool, optional) – whether JavaScript should be minified or not (default: True)
root_url (str, optional) –
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.root_url
can also be the empty string, in which case relative URLs, e.g., “static/css/bokeh.min.js”, are generated.Only valid with
'server'
and'server-dev'
modes
The following mode values are available for configuring a Resource object:
'inline'
configure to provide entire Bokeh JS and CSS inline'cdn'
configure to load Bokeh JS and CSS fromhttp://cdn.pydata.org
'server'
configure to load from a Bokeh Server'server-dev'
same asserver
but supports non-minified assets'relative'
configure to load relative to the given directory'relative-dev'
same asrelative
but supports non-minified assets'absolute'
configure to load from the installed Bokeh library static directory'absolute-dev'
same asabsolute
but supports non-minified assets
Once configured, a Resource object exposes the following public attributes:
-
css_raw
¶ any raw CSS that needs to be places inside
<style>
tags
-
css_files
¶ URLs of any CSS files that need to be loaded by
<link>
tags
-
messages
¶ any informational messages concerning this configuration
These attributes are often useful as template parameters when embedding Bokeh plots.
-
class
CSSResources
(mode=None, version=None, root_dir=None, minified=None, log_level=None, root_url=None, path_versioner=None, components=None)[source]¶ The CSSResources class encapsulates information relating to loading or embedding Bokeh client-side CSS.
- Parameters
mode (str) –
how should Bokeh CSS be included in output
See below for descriptions of available modes
version (str, optional) –
what version of Bokeh CSS to load
Only valid with the
'cdn'
moderoot_dir (str, optional) –
root directory for loading BokehJS resources
Only valid with
'relative'
and'relative-dev'
modesminified (bool, optional) – whether 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
The following mode values are available for configuring a Resource object:
'inline'
configure to provide entire BokehJS code and CSS inline'cdn'
configure to load Bokeh CSS fromhttp://cdn.pydata.org
'server'
configure to load from a Bokeh Server'server-dev'
same asserver
but supports non-minified CSS'relative'
configure to load relative to the given directory'relative-dev'
same asrelative
but supports non-minified CSS'absolute'
configure to load from the installed Bokeh library static directory'absolute-dev'
same asabsolute
but supports non-minified CSS
Once configured, a Resource object exposes the following public attributes:
-
css_raw
¶ any raw CSS that needs to be places inside
<style>
tags
-
css_files
¶ URLs of any CSS files that need to be loaded by
<link>
tags
-
messages
¶ any informational messages concerning this configuration
These attributes are often useful as template parameters when embedding Bokeh plots.