Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

ericsnekbytes
Copy link
Contributor

@ericsnekbytes ericsnekbytes commented Sep 1, 2023

This example adds three related extension packages:

  • step_counter
  • step_counter_extension
  • leap_counter_extension

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 ericsnekbytes changed the title Added provider-consumer example (multiple related packages). (DRAFT) Added provider-consumer example (multiple related packages). Sep 1, 2023
@ericsnekbytes ericsnekbytes requested a review from jtpio September 1, 2023 19:49
@ericsnekbytes
Copy link
Contributor Author

@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 ericsnekbytes changed the title (DRAFT) Added provider-consumer example (multiple related packages). Added provider-consumer example (multiple related packages). Sep 29, 2023
@ericsnekbytes ericsnekbytes marked this pull request as ready for review October 5, 2023 17:23
@ericsnekbytes
Copy link
Contributor Author

@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.

Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions as promised.

Comment on lines +6 to +8
it('should be tested', () => {
expect(1 + 1).toEqual(2);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you intend to implement the test here?

@ghost
Copy link

ghost commented Nov 17, 2023

@ericsnekbytes does this work with jupyterlab 3?

@ericsnekbytes
Copy link
Contributor Author

@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).

@ericsnekbytes ericsnekbytes added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 9, 2025
@ericsnekbytes
Copy link
Contributor Author

There are some unrelated pytest/playwright failures (running from a clean clone) affecting work here, tracked in:

@ericsnekbytes
Copy link
Contributor Author

Also running into this error, which seems to be successful but is returning a non-zero exit code:

Run jupyter labextension list 2>&1 | tee labextension.list
JupyterLab v4.4.3
/Library/Frameworks/Python.framework/Versions/3.11/share/jupyter/labextensions
step_counter v0.1.0 enabled OK
jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)

Error: Process completed with exit code 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants