Components no longer working with "inline" resources

The documentation for bokeh.embed.components (bokeh.embed — Bokeh 3.3.2 Documentation) states that:

The returned components assume that BokehJS resources are already loaded .

What does this mean for the case where BOKEH_RESOURCES="inline"?

In Bokeh V2 components would work without loading BokehJS resources as long as BOKEH_RESOURCES="inline". Starting with Bokeh V3 this is no longer the case. It produces this error:

Uncaught ReferenceError: Bokeh is not defined
    at HTMLDocument.fn

Is this a bug that was introduces in Bokeh V3, or is it now just honoring what was always intended per the documentation?

I think it must be this, and any other behavior in the past was accidental. I have personally never once used components outside the context of a template that loads BokehJS explicitly and separately, and that scenario was certainly the only motivating use case back when components was originally written.

Thanks @Bryan. My use case is loading components into a template in Django. The BOKEH_RESOURCES could be configured to cdn, server, or inline. In the case of cdn or server then we would load the BokehJS resources separately, but with inline we didn’t have to load anything else.

It appears to be missing a docstring, but Resources has a render() method that should work for any resource object (e.g. INLINE or CDN or a server one that you configure) that you could use in your template.

Just curious about the previous behavior, did all of BokehJS just get stuffed inside the script returned by components? I don’t see how it might have worked otherwise. But if so that was definitely not intentional.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.