bokeh
¶The bokeh
module itself contains a few useful functions for testing
and reporting issues:
test
(args=None)¶bokeh.document
¶The document module provides the Document class, which is a container for all Bokeh objects that mustbe reflected to the client side BokehJS library.
Document
(json_objs=None)¶The Document class is a container to hold Bokeh objects that requires reflecting to the client BokehJS library.
autoadd
¶bool
autostore
¶bool
context
¶PlotContext
the plot context for this document
ref
¶str
reference to the plot context for this document
add
(*objects)¶Add top-level objects (and any references they hold to sub-objects) to this Document.
Warning
This function should only be called on top level objects such as Plot, and Layout containers.
Parameters: | *objects (PlotObject) – objects to add to the Document |
---|---|
Returns: | None |
clear
()¶Remove all plots from this Document
Returns: | None |
---|
clear_callback_queue
(models=None)¶Clear the callback queue on given models.
Parameters: | models (seq[PlotObject], optional) – models to clear callbacks for (default: None) If models is None, clears callback queue on all models in this Document. |
---|---|
Returns: | None |
disable_callbacks
(models=None)¶Disable callbacks on given models.
Parameters: | models (seq[PlotObject], optional) – models to disable callbacks for (default: None) If models is None, disables callbacks on all models in this Document. |
---|---|
Returns: | None |
dump
(*models, **kw)¶Convert models to json objects.
Parameters: |
|
---|---|
Returns: | json objects |
Return type: | dict |
enable_callbacks
(models=None)¶Enable callbacks on given models.
Parameters: | models (seq[PlotObject], optional) – models to enable callbacks for (default: None) If models is None, enables callbacks on all models in this Document. |
---|---|
Returns: | None |
execute_callback_queue
(models=None)¶Execute all queued callbacks on the given models.
Parameters: | models (seq[PlotObject], optional) – models to execute callbacks for (default: None) If models is None, executes the callback queue on all models in this Document. |
---|---|
Returns: | None |
load
(*objs, **kwargs)¶Convert json objects to models and load them into this Document.
Parameters: | *objs (str) – json object strings to convert |
---|---|
Keyword Arguments: | |
|
|
Returns: | models loaded from json |
Return type: | set[Plotobject] |
merge
(json_objs)¶Merge’s json objects from another document into this one using the plot context id from the json_objs which are passed in children from this document are merged with the children from the json that is passed in
Parameters: | json_objs – json objects from session.pull() |
---|---|
Returns: | None |
prune
()¶Remove all models that are not in the plot context
bokeh.session
¶The session module provides the Session class, which encapsulates a connection to a Document that resides on a Bokeh server.
The Session class provides methods for creating, loading and storing documents and objects, as well as methods for user-authentication. These are useful when the server is run in multi-user mode.
Session
(name='http://localhost:5006/', root_url='http://localhost:5006/', userapikey='nokey', username='defaultuser', load_from_config=True, configdir=None)¶Encapsulate a connection to a document stored on a Bokeh Server.
Parameters: |
|
---|
base_url
¶str
configdir
¶str
configfile
¶str
http_session
¶requests.session
userapikey
¶str
userinfo
¶dict
username
¶str
browser_login
()¶Open a browser with a token that logs the user into a bokeh server.
Note
This is useful in multi-user mode.
Returns: | None |
---|
data_source
(name, data)¶Makes and uploads a server data source to the server.
Note
The server must be configured with a data directory.
Parameters: |
|
---|---|
Returns: | a ServerDataSource |
execute
(method, url, headers=None, **kwargs)¶Execute an HTTP request using the current session.
Returns the response
Parameters: |
|
---|---|
Keyword Arguments: | |
Any extra arguments to pass into the requests library |
|
Returns: | response |
Returns the response
execute_json
(method, url, headers=None, **kwargs)¶same as execute, except ensure that json content-type is set in headers and interprets and returns the json response
find_doc
(name)¶Return the docid of the document with a title matching name
.
Note
Creates a new document with the given title if one is not found.
Parameters: | name (string) – name for the document |
---|---|
Returns: | str |
Return type: | docid |
get_api_key
(docid)¶Retrieve the document API key from the server.
Parameters: | docid (string) – docid of the document to retrive API key for |
---|---|
Returns: | string |
Return type: | apikey |
get_json
(url, headers=None, **kwargs)¶Return the result of an HTTP ‘get’.
Parameters: |
|
---|---|
Keyword Arguments: | |
Any extra arguments to pass into the requests library |
|
Returns: | JSON |
Return type: | response |
load
()¶Loads the server configuration information from disk
Returns: | None |
---|
load_document
(doc)¶Loads data for the session and merge with the given document.
Parameters: | doc (Document) – document to load data into |
---|---|
Returns: | None |
load_object
(obj, doc)¶Update an object in a document with data pulled from the server.
Parameters: |
|
---|---|
Returns: | None |
login
(username, password)¶Log a user into a bokeh server.
Note
This is useful in multi-user mode.
Parameters: |
|
---|---|
Returns: | None |
make_doc
(title)¶Makes a new document with the given title on the server
Note
user information is reloaded
Returns: | None |
---|
object_link
(obj)¶Return a URL to a server page that will render the given object.
Parameters: | obj (PlotObject) – object to render |
---|---|
Returns: | URL string |
poll_document
(document, interval=0.5)¶Periodically ask the server for updates to the document.
post_json
(url, headers=None, **kwargs)¶Return the result of an HTTP ‘post’
Parameters: |
|
---|---|
Keyword Arguments: | |
Any extra arguments to pass into the requests library |
|
Returns: | JSON |
Return type: | response |
pull
(typename=None, objid=None)¶Pull JSON objects from the server.
Returns a specific object if both typename
and objid
are
supplied. Otherwise, returns all objects for the currently configured
document.
This is a low-level function.
Parameters: |
|
---|
Note
you must supply either typename
AND objid
or omit both.
Returns: | JSON |
---|---|
Return type: | attrs |
push
(*jsonobjs)¶Push JSON objects to the server.
This is a low-level function.
Parameters: | *jsonobjs (JSON) – objects to push to the server |
---|---|
Returns: | None |
register
(username, password)¶Register a new user with a bokeh server.
Note
This is useful in multi-user mode.
Parameters: |
|
---|---|
Returns: | None |
save
()¶Save the server configuration information to JSON
Returns: | None |
---|
show
(obj)¶Display an object as HTML in IPython using its display protocol.
Parameters: | obj (PlotObject) – object to display |
---|---|
Returns: | None |
store_document
(doc, dirty_only=True)¶Store a document on the server.
Returns the models that were actually pushed.
Parameters: |
|
---|---|
Returns: | list[PlotObject] |
Return type: | models |
store_objects
(*objs, **kwargs)¶Store objects on the server
Returns the objects that were actually stored.
Parameters: | *objs (PlotObject) – objects to store |
---|
Returns: | set[PlotObject] |
---|---|
Return type: | models |
use_doc
(name=None, docid=None)¶Configure the session to use a given document.
Parameters: |
|
---|
Note
only one of name
or docid
may be supplied.
Creates a document for with the given name if one is not present on the server.
Returns: | None |
---|
configdir
filename where our config are stored.
TestSession
(*args, **kwargs)¶Currently, register and login do not work, everything else should work in theory, but we’ll have to test this as we go along and convert tests