Multiple questions with Object-Oriented Bokeh [OBSOLETE] Multiple questions with Object-Oriented Bokeh [OBSOLETE] python python

Multiple questions with Object-Oriented Bokeh [OBSOLETE]


I'm searching for the same answers (lack of documentation makes it difficult).

In answer, to question #1, what is the utility of "extra_generated_classes":

tl;dr extra_generated_classes defines a modulename, classname, and parentname used in template generating js/html code, and extends the parent class passed into the app class (usually HBox or VBox in the examples).

Longer answer. Look at the source code in bokeh/server/utils/plugins.py, this is the code that is run on code passed to bokeh-server using the --script command line argument. At the end of plugins.py, you can see that extra_generated_classes is passed to the flask method render_template, which renders a Jinja2 template. Looking inside the template, oneobj.html, extra_generated_classes is an array of arrays of three things: modulename, classname, and parentname, which are passed into bokeh.server.generatejs:

{% block extra_scripts %}  {% for modulename, classname, parentname in extra_generated_classes %}  <script    src="{{ url_for('bokeh.server.generatejs', modulename=modulename, classname=classname, parentname=parentname) }}"  ></script>  {% endfor %}{% endblock %}

bokeh.server.generatejs is a Python code in bokeh/server/views/plugins.py, and only calls render_template for a template app.js, which you can find in bokeh/server/templates. This template takes the modulename, classname, and parentname, and basically creates js code which extends the parentname (e.g. HBox or VBox) to the classname (your app).