What is a `model` in JupyterLab?

I don’t know if I missed it somewhere, but I think it would be incredibly helpful for people developing extensions to provide a document that describes the Widget-model pattern. It seems this is the de-facto way to synchronise data between widgets but as far as I can tell is not mentioned in any of the examples/ docs.

It’s touched on in Documents — JupyterLab 3.0.14 documentation, but this is written in a way that implies that models are particular to Documents and it doesn’t talk about them in more general terms.

If the Widget example (extension-examples/index.ts at 8bc09d2839efed8078c9fbc43da0fd39a0b7d0a3 · jupyterlab/extension-examples · GitHub) was modified to include a model - and even better extended to demonstrate syncing between multiple widgets, I think this would be incredibly instructive.

It seems to me that hooking into pre-existing JLab functionality is quite well supported/ documented, but re-using and extending it is quite challenging at present.

I’ve been taking quite a deep dive into the source for a cool extension I’m trying to make. Very happy to discuss all things further!

2 Likes