jupyterlab / extension-examples

JupyterLab Extensions by Examples
BSD 3-Clause "New" or "Revised" License
453 stars 167 forks source link

Added provider-consumer example (multiple related packages). #245

Open ericsnekbytes opened 1 year ago

ericsnekbytes commented 1 year ago

This example adds three related extension packages:

With all 3 installed in a JupyterLab environment, users will get a provider extension that counts steps (a token + a default service implementation that holds step count data), and two alternate consumer plugins that consume the provider's step_counter service and provide disparate interactivity via buttons in each extension that count steps differently.

Provider/consumer extension sample image

ericsnekbytes commented 1 year ago

@jtpio This is pretty much done (minus some small formatting items and the signalling issue mentioned above) if you want to take a look. Keep in mind that this is intended to be a MINIMAL demonstration of the features needed to implement the provider-consumer pattern (I skipped over several opportunities to make it "better" in favor of highly reduced complexity).

ericsnekbytes commented 12 months ago

@fcollonval If you have time to review I'd like to get this approved, the Dual Compatibility document has a spinoff "Plugin System" document (see top post description) that depends on this example so this should be merged first. My plan now is to try to get the document and examples merged first, then do a follow-up PR for the unit tests and repo-referencing for the code snippets.

ghost commented 10 months ago

@ericsnekbytes does this work with jupyterlab 3?

ericsnekbytes commented 10 months ago

@ericsnekbytes does this work with jupyterlab 3?

@terlan4 It does work in JupyterLab 3, just tested it. The Provider/Consumer pattern is a foundational piece of JupyterLab's design and of its extension system, (so it is certainly relevant to both).