I made a custom glyph (named “Pick”) as part of a python package I’m developing. It works fine when I compile it at runtime, but I’d like to prebuild it and distribute it with the rest of the package. I don’t want to make a node package and put it on NPM, since my extension is small and I don’t need the extra overhead
bokeh init --interactive and declined to make a
tsconfig.json. I then changed my imports in the typescript for the custom extension to use
@bokehjs, and following the Panel guide I modified my
index.ts files, removed the
__implementation__ attribute on the Python class, and set a
__module__ variable on the typescript class. You can see the modifications I made here.
These changes allowed
Uncaught (in promise) Error: Model 'ptplot.models.pick.Pick' does not exist. This could be due to a widget or a custom model not being registered before first usage. at ModelResolver.get (bokeh-2.3.3.js:1359) at Function._instantiate_object (bokeh-2.3.3.js:872) at Function._instantiate_references_json (bokeh-2.3.3.js:887) at Function.from_json (bokeh-2.3.3.js:1130) at _embed_items (bokeh-2.3.3.js:566) at Object.embed_items (bokeh-2.3.3.js:558)
Looking at the Chrome inspector my extension is getting registered, but the problem seems to be that it’s getting registered as
_all_models.get("Pick") returns the right thing) rather than
"ptplot.models.pick.Pick" which is what Bokeh uses as the default location for a Model.
Is there any way I can either register my extension as “ptplot.models.pick.Pick”, or change the Python implementation to look for the JS as “Pick”? Or is this not the right way to go about doing this? Any advice would be appreciated. Thanks!