Skip to content

Commit

Permalink
Merge pull request jupyterlab#139 from jupyterlab/fix/jlab3-corrections
Browse files Browse the repository at this point in the history
Passthrough following JLab3 update
  • Loading branch information
jtpio authored Jan 19, 2021
2 parents 944f073 + 7595d79 commit 0254ccb
Show file tree
Hide file tree
Showing 21 changed files with 184 additions and 163 deletions.
34 changes: 12 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
node-version: "12.x"
- name: Install Python
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: "3.7"
architecture: "x64"
Expand All @@ -88,9 +88,7 @@ jobs:
- name: Install the Python dependencies
if: steps.filter.outputs.extension == 'true'
run: |
python -m pip install --upgrade pip
python -m pip install jupyter_packaging
python -m pip install jupyterlab
python -m pip install --upgrade pip jupyter_packaging~=0.7.9 jupyterlab~=3.0
- name: Install the NPM dependencies
if: steps.filter.outputs.extension == 'true'
run: |
Expand All @@ -112,9 +110,7 @@ jobs:
run: |
cd ${EXAMPLE_FOLDER}
pip install -e .
jupyter labextension list 1>labextensions 2>&1
cat labextensions
cat labextensions | grep -i "@jupyterlab-examples/*.*OK"
jupyter labextension list 2>&1 | grep -ie "@jupyterlab-examples/*.*OK"
python -m jupyterlab.browser_check
pip uninstall -y $(python setup.py --name)
env:
Expand Down Expand Up @@ -161,7 +157,7 @@ jobs:
shell: bash
- name: Install Python
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: "3.7"
architecture: "x64"
Expand All @@ -182,9 +178,7 @@ jobs:
- name: Install the Python dependencies
if: steps.filter.outputs.extension == 'true'
run: |
python -m pip install --upgrade pip
python -m pip install jupyter_packaging
python -m pip install jupyterlab
python -m pip install --upgrade pip jupyter_packaging~=0.7.9 jupyterlab~=3.0
- name: Install the NPM dependencies
if: steps.filter.outputs.extension == 'true'
run: |
Expand All @@ -206,10 +200,8 @@ jobs:
- name: Check extension as dev
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
run: |
jupyter server extension list 1>serverextensions 2>&1
cat serverextensions | grep "jlab_ext_example.*OK"
jupyter labextension list 1>labextensions 2>&1
cat labextensions | grep "@jupyterlab-examples/server-extension.*OK"
jupyter server extension list 2>&1 | grep -ie "jlab_ext_example.*OK"
jupyter labextension list 2>&1 | grep -ie "@jupyterlab-examples/server-extension.*OK"
- name: Clean extension installation
if: steps.filter.outputs.extension == 'true'
run: |
Expand All @@ -222,14 +214,11 @@ jobs:
run: |
cd advanced/server-extension
pip install -e .
jupyter server extension enable --py jlab_ext_example
- name: Check extension as dev
if: steps.filter.outputs.extension == 'true' && ( startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') )
run: |
jupyter server extension list 1>serverextensions 2>&1
cat serverextensions | grep "jlab_ext_example.*OK"
jupyter labextension list 1>labextensions 2>&1
cat labextensions | grep "@jupyterlab-examples/server-extension.*OK"
jupyter server extension list 2>&1 | grep -ie "jlab_ext_example.*OK"
jupyter labextension list 2>&1 | grep -ie "@jupyterlab-examples/server-extension.*OK"
python -m jupyterlab.browser_check
build_all:
Expand All @@ -255,7 +244,7 @@ jobs:
with:
node-version: "12.x"
- name: Install Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: "3.7"
architecture: "x64"
Expand All @@ -272,11 +261,12 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- name: Install the Python dependencies
run: python -m pip install jupyterlab
run: python -m pip install jupyterlab~=3.0 pytest pytest-check-links
- name: Bootstrap the jlpm deps
run: jlpm
- name: Build all the extensions
run: |
pytest --check-links
jlpm build-ext
jlpm lint:check
jlpm install-ext
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
**/lib
**/package.json
**/labextension
**/.pytest_cache
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ You can expect from each example:
- The list of used JupyterLab API and Extension Points.
- Explanations of the internal working, illustrated with code snippets.

We have structured the examples based on the [extension points](https://jupyterlab.readthedocs.io/en/stable/developer/extension_points.html). Browse the previews below or skip them and [jump directly to the sections for developers](#prerequisites).
We have structured the examples based on the [extension points](https://jupyterlab.readthedocs.io/en/stable/extension/extension_points.html). Browse the previews below or skip them and [jump directly to the sections for developers](#prerequisites).

You are welcome to open any [issue](https://github.com/jupyterlab/extension-examples/issues) or [pull request](https://github.com/jupyterlab/extension-examples/pulls).

Expand Down Expand Up @@ -255,16 +255,14 @@ jlpm clean-ext
Go to the example directory you want to install, e.g. `cd ./basics/hello-world`, and run the following commands:

```bash
jlpm install
jlpm run build
jupyter labextension install .
pip install -e .
jupyter labextension develop . --overwrite
```

Rebuild the JupyterLab application:
Rebuild the extension:

```bash
jlpm run build
jupyter lab build
```

You can now start JupyterLab and check if your extension is working fine:
Expand Down Expand Up @@ -296,11 +294,11 @@ We are using [embedme](https://github.com/zakhenry/embedme) to embed code snippe

## Install a Published Extension

Once your extension is published (outside of this scope), you can install it
Once your extension is published on [pypi.org](https://pypi.org/) (outside of this scope), you can install it
with the following command:

```bash
jupyter labextension install <published_extension>
pip install <published_extension>
```

## About JupyterLab
Expand All @@ -313,9 +311,9 @@ of libraries from different languages.

Complementary to these examples, you can rely on the official JupyterLab documentation.

- [Extension Developer Guide](https://jupyterlab.readthedocs.io/en/stable/developer/extension_dev.html)
- [Common Extension Points](https://jupyterlab.readthedocs.io/en/stable/developer/extension_points.html)
- [Astronomy Picture of the Day JupyterLab Extension](https://jupyterLab.readthedocs.io/en/stable/developer/extension_tutorial.html)
- [Extension Developer Guide](https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html)
- [Common Extension Points](https://jupyterlab.readthedocs.io/en/stable/extension/extension_points.html)
- [Astronomy Picture of the Day JupyterLab Extension](https://jupyterLab.readthedocs.io/en/stable/extension/extension_tutorial.html)

## Credits

Expand Down
6 changes: 3 additions & 3 deletions advanced/kernel-messaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

![Kernel Messages](preview.gif)

## Custom Kernel Interactions: Kernel Managment and Messaging
## Custom Kernel Interactions: Kernel Management and Messaging

One of the main features of JupyterLab is the possibility to manage and
interact with [kernels](https://jupyter-client.readthedocs.io/en/latest/kernels.html).
Expand All @@ -32,7 +32,7 @@ execution result.
## Initializing and managing a Kernel Session (`panel.ts`)

Jupyterlab provides a class `SessionContext`
([see the documentation](https://jupyterlab.github.io/jupyterlab/apputils/classes/sessioncontext.html))
([see the documentation](https://jupyterlab.github.io/jupyterlab/classes/_apputils_src_index_.sessioncontext.html))
that manages a single kernel session. Here is the code to initialize such session:

```ts
Expand Down Expand Up @@ -76,7 +76,7 @@ const manager = app.serviceManager;
With these lines, you can extend the panel widget from the [signal example](../../basics/signals) to initialize a
kernel. In addition, you will create a `KernelModel` class in it and
overwrite the `dispose` and `onCloseRequest` methods of the `StackedPanel`
([see the documentation](https://jupyterlab.github.io/lumino/api/widgets/classes/stackedpanel.html))
([see the documentation](https://jupyterlab.github.io/lumino/widgets/classes/stackedpanel.html))
to free the kernel session resources if the panel is closed. The whole adapted
panel class looks like this:

Expand Down
28 changes: 14 additions & 14 deletions advanced/kernel-output/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ followed by the creation of the visual element.
## Initializing a Kernel Session

To interact with a kernel, you can create a `SessionContext`
object ([see the documentation](https://jupyterlab.github.io/jupyterlab/apputils/classes/sessioncontext.html)).
object ([see the documentation](https://jupyterlab.github.io/jupyterlab/classes/_apputils_src_index_.sessioncontext.html)).
Here it is stored in the private `_sessionContext` variable:

```ts
// src/panel.ts#L94-L94
// src/panel.ts#L95-L95

private _sessionContext: SessionContext;
```
Expand All @@ -50,7 +50,7 @@ A `SessionContext` handles a single kernel session. The session itself (not yet
the kernel) is started with these lines:

```ts
// src/panel.ts#L44-L48
// src/panel.ts#L45-L49

this._sessionContext = new SessionContext({
sessionManager: manager.sessions,
Expand All @@ -63,7 +63,7 @@ The private session variable is exposed as read-only for other users
through a getter method:

```ts
// src/panel.ts#L72-L74
// src/panel.ts#L73-L75

get session(): ISessionContext {
return this._sessionContext;
Expand All @@ -75,7 +75,7 @@ with this line:

<!-- prettier-ignore-start -->
```ts
// src/panel.ts#L58-L69
// src/panel.ts#L59-L70

void this._sessionContext
.initialize()
Expand All @@ -93,13 +93,13 @@ void this._sessionContext
<!-- prettier-ignore-end -->

When a session has no predefined preferred kernel, a dialog will request the user to choose a kernel to start. Conveniently, this can
also be an already existing kernel, as you will see later.
also be an already existing kernel.

The following two methods ensure the clean disposal of the session
when you close the panel.

```ts
// src/panel.ts#L76-L79
// src/panel.ts#L77-L80

dispose(): void {
this._sessionContext.dispose();
Expand All @@ -108,7 +108,7 @@ dispose(): void {
```

```ts
// src/panel.ts#L89-L92
// src/panel.ts#L90-L93

protected onCloseRequest(msg: Message): void {
super.onCloseRequest(msg);
Expand All @@ -120,11 +120,11 @@ protected onCloseRequest(msg: Message): void {

The `SimplifiedOutputArea` class is a `Widget`, as described in the [widget example](../../widget-tracker/widgets/README.md).
It has the ability to display the results of a notebook cell execution.
You can instantiate it with a new `OutputAreaModel`; this is class containing
You can instantiate it with a new `OutputAreaModel`; this class is containing
the data to show:

```ts
// src/panel.ts#L50-L54
// src/panel.ts#L51-L55

this._outputareamodel = new OutputAreaModel();
this._outputarea = new SimplifiedOutputArea({
Expand All @@ -134,11 +134,11 @@ this._outputarea = new SimplifiedOutputArea({
```

`SimplifiedOutputArea` provides a static method `execute` that sends
some code to a kernel through a `ISessionContext` ([see documentation](https://jupyterlab.github.io/jupyterlab/outputarea/classes/simplifiedoutputarea.html#execute)). And then it displays the result
some code to a kernel through a `ISessionContext` ([see documentation](https://jupyterlab.github.io/jupyterlab/classes/_outputarea_src_index_.simplifiedoutputarea.html#execute)). And then it displays the result
in the specific `SimplifiedOutputArea` object you created:

```ts
// src/panel.ts#L81-L87
// src/panel.ts#L82-L88

execute(code: string): void {
SimplifiedOutputArea.execute(code, this._outputarea, this._sessionContext)
Expand All @@ -158,7 +158,7 @@ To display the `SimplifiedOutputArea` Widget you need to add it to your
panel with:

```ts
// src/panel.ts#L56-L56
// src/panel.ts#L57-L57

this.addWidget(this._outputarea);
```
Expand Down Expand Up @@ -266,4 +266,4 @@ the variable name in the input dialog, it will be displayed in the example panel
## Where to Go Next

This example makes use of input dialogs. To know which input dialogs are available
have a look at the [documentation](https://jupyterlab.readthedocs.io/en/stable/developer/ui_helpers.html).
have a look at the [documentation](https://jupyterlab.readthedocs.io/en/stable/extension/ui_helpers.html#dialogs).
1 change: 1 addition & 0 deletions advanced/kernel-output/src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { OutputAreaModel, SimplifiedOutputArea } from '@jupyterlab/outputarea';
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';

import { KernelMessage, ServiceManager } from '@jupyterlab/services';

import {
ITranslator,
nullTranslator,
Expand Down
Loading

0 comments on commit 0254ccb

Please sign in to comment.