-
Notifications
You must be signed in to change notification settings - Fork 182
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
ericsnekbytes
wants to merge
32
commits into
jupyterlab:main
Choose a base branch
from
ericsnekbytes:provider_consumer_example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
3e2dfa5
Initial provider-consumer sample, WIP.
ericsnekbytes 7442fe6
Fixed method name.
ericsnekbytes 0c731cf
Added comments to the provider-consumer samples.
ericsnekbytes f3fe812
Added comments to provider/consumer example.
ericsnekbytes 14350de
Comment cleanup.
ericsnekbytes 2eb6512
Minor formatting.
ericsnekbytes 9d115b5
Updated project description text.
ericsnekbytes 03f9cc9
Updated project description text.
ericsnekbytes de11b88
Minor formatting.
ericsnekbytes 7a5c3c0
Minor formatting.
ericsnekbytes 82d1ad5
Added third provider-consumer sub example, an additional consumer.
ericsnekbytes 76438b9
Added step counter signal for display updates.
ericsnekbytes c086518
Update readme
ericsnekbytes e46c5b9
Renamed folders to match poackage names.
ericsnekbytes 9645adf
Updated local dependency paths.
ericsnekbytes 8bab7f7
Updated extension specific READMEs.
ericsnekbytes 44238f1
Added preview, updated README.
ericsnekbytes efbe9a2
Added singleton package metadata notes.
ericsnekbytes 8b3872c
Update README/fix links.
ericsnekbytes afee7d7
Updated titles/links.
ericsnekbytes e1a5525
Update titles/links in READMEs.
ericsnekbytes 2689a44
Updated root package metadata.
ericsnekbytes 164b0ad
Merge branch 'main' into provider_consumer_example
ericsnekbytes b1452cd
Workaround for dependency 'any' usage and version conflicts.
ericsnekbytes e420ec7
Linting.
ericsnekbytes ea8a711
Fix linting errors for unrelated packages.
ericsnekbytes 626490b
Modify tsconfigs: Re-enable implicit any checks, add skipLibCheck.
ericsnekbytes bfb24cc
Extra linting.
ericsnekbytes cb58d6c
Revised to address feedback.
ericsnekbytes 101cfd6
Added explanation of declaration merging.
ericsnekbytes 1e56e65
Add changes from PR feedback.
ericsnekbytes 7b0f58e
Add updated version of entities with types.
ericsnekbytes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY | ||
_commit: v4.2.0 | ||
_src_path: https://github.com/jupyterlab/extension-template | ||
author_email: [email protected] | ||
author_name: My Name | ||
has_binder: false | ||
has_settings: false | ||
kind: frontend | ||
labextension_name: leap_counter_extension | ||
project_short_description: Adds a leap counter/button (1 of 3 related examples). This | ||
extension holds the UI/interface. | ||
python_name: leap_counter_extension | ||
repository: '' | ||
test: true | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
*.bundle.* | ||
lib/ | ||
node_modules/ | ||
*.log | ||
.eslintcache | ||
.stylelintcache | ||
*.egg-info/ | ||
.ipynb_checkpoints | ||
*.tsbuildinfo | ||
leap_counter_extension/labextension | ||
# Version file is handled by hatchling | ||
leap_counter_extension/_version.py | ||
|
||
# Integration tests | ||
ui-tests/test-results/ | ||
ui-tests/playwright-report/ | ||
|
||
# Created by https://www.gitignore.io/api/python | ||
# Edit at https://www.gitignore.io/?templates=python | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage/ | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# End of https://www.gitignore.io/api/python | ||
|
||
# OSX files | ||
.DS_Store | ||
|
||
# Yarn cache | ||
.yarn/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
**/node_modules | ||
**/lib | ||
**/package.json | ||
!/package.json | ||
leap_counter_extension |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Leap Counter (Reusability 1C) (leap_counter_extension) | ||
|
||
This multi-part example comes from the [Jupyter Plugin System guide](https://jupyterlab.readthedocs.io/en/latest/extension/plugin_system.html), | ||
and demonstrates Jupyter's provider/consumer pattern. You can find | ||
details about this example on that page. | ||
|
||
This is one of three related extension examples that demonstrate | ||
JupyterLab's provider-consumer pattern, where plugins can depend | ||
on and reuse features from one another. The three packages that | ||
make up the complete example are: | ||
|
||
1. The step_counter package. This package holds a token, a | ||
class + an interface that make up a stock implementation of | ||
the "step_counter" service, and a provider plugin that | ||
makes an instance of the Counter available to JupyterLab | ||
as a service object. | ||
|
||
2. The step_counter_extension package, that holds a | ||
UI/interface in JupyterLab for users to count their steps that | ||
connects with/consumes the step_counter service object via a | ||
consumer plugin. | ||
|
||
3. (\*) The leap_counter_extension package (this one), that holds an alternate | ||
way for users to count steps (a leap is 5 steps). Like the step_counter_extension | ||
package, this holds a UI/interface in JupyterLab, and a consumer | ||
plugin that also requests/consumes the step_counter service | ||
object. The leap_counter_extension package demonstrates how | ||
an unrelated plugin can depend on and reuse features from | ||
an existing plugin. Users can install either the | ||
step_counter_extension, the leap_counter_extension or both | ||
to get whichever features they prefer (with both reusing | ||
the step_counter service object). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@jupyterlab/testutils/lib/babel.config'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"packageManager": "python", | ||
"packageName": "leap_counter_extension", | ||
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package leap_counter_extension" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config'); | ||
|
||
const esModules = [ | ||
'@codemirror', | ||
'@jupyter/ydoc', | ||
'@jupyterlab/', | ||
'lib0', | ||
'nanoid', | ||
'vscode-ws-jsonrpc', | ||
'y-protocols', | ||
'y-websocket', | ||
'yjs' | ||
].join('|'); | ||
|
||
const baseConfig = jestJupyterLab(__dirname); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
automock: false, | ||
collectCoverageFrom: [ | ||
'src/**/*.{ts,tsx}', | ||
'!src/**/*.d.ts', | ||
'!src/**/.ipynb_checkpoints/*' | ||
], | ||
coverageReporters: ['lcov', 'text'], | ||
testRegex: 'src/.*/.*.spec.ts[x]?$', | ||
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`] | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
try: | ||
from ._version import __version__ | ||
except ImportError: | ||
# Fallback when using the package in dev mode without installing | ||
# in editable mode with pip. It is highly recommended to install | ||
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs | ||
import warnings | ||
warnings.warn("Importing 'leap_counter_extension' outside a proper installation.") | ||
__version__ = "dev" | ||
|
||
|
||
def _jupyter_labextension_paths(): | ||
return [{ | ||
"src": "labextension", | ||
"dest": "leap_counter_extension" | ||
}] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.