Ohhhh! Makes more sense why itās not working then haha. I still am very curious as to how the figures and etc. makes it into the result of pull_session but not other customization (done in the app itself too)! In any case though, there are a few possibilities that I can think of right now for implementation (Iāll give one a go
) -
The simplest version is just attaching a list of changes to a document every time the document is pulled, i.e. we donāt completely store the document, just the changes are stored.
So now pull_session has the functionality:
with pull_session(url=app_url) as session:
session.document.x # added by pull_session
session.document.y # added by pull_session
While it would be fine to just expect the user to mutate all their data from there how they please, it may be nice to enhance pull_session to accept functions that act on various properties of the document. I wouldnāt recommend this as a standalone improvement to pull_session since itās unnecessarily over-complicating it - but if weāre already enhancing it I think it becomes more viable.
In terms of the hooks, I think it makes sense to also put them in bokeh.client, given its purpose: Creating and customizing specific sessions of a Bokeh application running in a Bokeh Server, before passing them to a viewer.
Since we donāt want to implement the actual storage functionality ourselves itās as simple as providing to bokeh.client a class/object that implements store
and retrieve
.
class MyChangeManager:
def store(self, change, property_name):
'redis or other store details, associate with property_name provided by bokeh'
def retrieve(self, property_name):
item = 'retrieve from store by id'
return item
On our side we implement the generation of uniqueIDs. The only remaining issue is āwhere do these changes get specifiedā? Well ideally they get specified in the bokeh application, whether it be a curdoc()
version or a def app(doc):
. Therefore, the MyChangeManager
needs to also live within the bokeh server and be synced across processes, and then we provide the method save
that can be used actually in the app to indicate to bokeh that a property needs to be saved to the store.
Largely spitballing here, overall I donāt think itās that large of an implementation on the bokeh side, and should only remain complex enough to enable any type of store. Thoughts?