Skip to content

Commit 5f66cbe

Browse files
authored
Merge pull request #51 from jtpio/lab3
Update to JupyterLab 3 new extension system
2 parents 753443a + a2cb791 commit 5f66cbe

17 files changed

+4870
-814
lines changed

.github/workflows/build.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: TMP fix - install libgbm1
14-
run: sudo apt install -y libgbm1
1513
- name: Checkout
16-
uses: actions/checkout@v1
14+
uses: actions/checkout@v2
1715
- name: Install node
1816
uses: actions/setup-node@v1
1917
with:
2018
node-version: '10.x'
2119
- name: Install Python
22-
uses: actions/setup-python@v1
20+
uses: actions/setup-python@v2
2321
with:
2422
python-version: '3.7'
2523
architecture: 'x64'
26-
- name: Install JupyterLab
27-
run: python -m pip install jupyterlab
28-
- name: Install the ipylab Python package
29-
run: python -m pip install -e .
30-
- name: Install the ipylab JupyterLab extension
24+
- name: Install dependencies
3125
run: |
32-
jlpm && jlpm run build
33-
jupyter labextension install .
26+
python -m pip install --upgrade pip
27+
python -m pip install jupyter_packaging
28+
python -m pip install --pre jupyterlab
29+
- name: Install the ipylab Python package and JupyterLab extension
30+
run: |
31+
python -m pip install .
32+
jupyter labextension list 2>&1 | grep -ie "ipylab.*enabled.*ok" -
3433
- name: Browser check
35-
run: python -m jupyterlab.browser_check
34+
run: |
35+
python -m jupyterlab.browser_check

.github/workflows/packaging.yml

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Packaging
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: '*'
8+
9+
env:
10+
PIP_DISABLE_PIP_VERSION_CHECK: 1
11+
12+
defaults:
13+
run:
14+
shell: bash -l {0}
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
- name: Install node
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: '14.x'
26+
- name: Install Python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: '3.9'
30+
architecture: 'x64'
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip wheel
34+
python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4"
35+
- name: Build pypi distributions
36+
run: |
37+
python setup.py sdist bdist_wheel
38+
- name: Build npm distributions
39+
run: |
40+
npm pack
41+
cp *.tgz dist
42+
- name: Build checksum file
43+
run: |
44+
cd dist
45+
sha256sum * | tee SHA256SUMS
46+
- name: Upload distributions
47+
uses: actions/upload-artifact@v2
48+
with:
49+
name: dist ${{ github.run_number }}
50+
path: ./dist
51+
52+
install:
53+
runs-on: ${{ matrix.os }}-latest
54+
needs: [build]
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
os: [ubuntu, macos, windows]
59+
python: ['3.6', '3.9']
60+
include:
61+
- python: '3.6'
62+
dist: 'ipylab*.tar.gz'
63+
- python: '3.9'
64+
dist: 'ipylab*.whl'
65+
- os: windows
66+
py_cmd: python
67+
- os: macos
68+
py_cmd: python3
69+
- os: ubuntu
70+
py_cmd: python
71+
steps:
72+
- name: Install Python
73+
uses: actions/setup-python@v2
74+
with:
75+
python-version: ${{ matrix.python }}
76+
architecture: 'x64'
77+
- uses: actions/download-artifact@v2
78+
with:
79+
name: dist ${{ github.run_number }}
80+
path: ./dist
81+
- name: Install the prerequisites
82+
run: |
83+
${{ matrix.py_cmd }} -m pip install pip wheel
84+
- name: Install the package
85+
run: |
86+
cd dist
87+
${{ matrix.py_cmd }} -m pip install -vv ${{ matrix.dist }}
88+
- name: Validate environment
89+
run: |
90+
${{ matrix.py_cmd }} -m pip freeze
91+
${{ matrix.py_cmd }} -m pip check
92+
- name: Validate the install
93+
run: |
94+
jupyter labextension list
95+
jupyter labextension list 2>&1 | grep -ie "ipylab.*enabled.*ok" -

.github/workflows/publish.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v1
11+
- uses: actions/checkout@v2
1212
- name: Install node
1313
uses: actions/setup-node@v1
1414
with:
15-
node-version: '10.x'
15+
node-version: '12.x'
1616
registry-url: 'https://registry.npmjs.org'
1717
- name: Set up Python
18-
uses: actions/setup-python@v1
18+
uses: actions/setup-python@v2
1919
with:
2020
python-version: '3.x'
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
24+
pip install setuptools wheel twine jupyter-packaging jupyterlab
2525
- name: Build and publish to PyPI
2626
env:
2727
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
@@ -31,12 +31,12 @@ jobs:
3131
twine upload dist/*
3232
- uses: actions/setup-node@v1
3333
with:
34-
node-version: '10.x'
34+
node-version: '12.x'
3535
registry-url: 'https://registry.npmjs.org'
3636
- name: Publish to npm
3737
env:
3838
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3939
run: |
4040
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
4141
npm publish
42-
42+

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,5 @@ ipylab/labextension/*.tgz
156156
ipylab/labextension
157157

158158
package-lock.json
159-
yarn.lock
160159

161160
.vscode

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
**/node_modules
33
**/lib
44
**/package.json
5+
ipylab/labextension

MANIFEST.in

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
include LICENSE.txt
22
include README.md
33

4-
include setupbase.py
4+
include setup.py
5+
include pyproject.toml
56
include pytest.ini
67
include .coverage.rc
78

89
include tsconfig.json
910
include package.json
10-
include ipylab/labextension/*.tgz
1111

1212
# Documentation
1313
graft docs
@@ -24,8 +24,9 @@ graft tests
2424
prune tests/build
2525

2626
# Javascript files
27-
graft ipylab/nbextension
27+
graft ipylab/labextension
2828
graft src
29+
graft style
2930
prune **/node_modules
3031
prune coverage
3132
prune lib

README.md

+6-15
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,10 @@ You can install using `pip`:
4848
pip install ipylab
4949
```
5050

51-
Or with `conda`:
51+
Or with `mamba` / `conda`:
5252

5353
```bash
54-
conda install -c conda-forge ipylab
55-
```
56-
57-
To install the JupyterLab extension:
58-
59-
```bash
60-
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipylab
54+
mamba install -c conda-forge ipylab
6155
```
6256

6357
## Running the examples locally
@@ -69,9 +63,6 @@ To try out the examples locally, the recommended way is to create a new environm
6963
conda create -n ipylab-examples -c conda-forge jupyterlab ipylab ipytree bqplot ipywidgets numpy
7064
conda activate ipylab-examples
7165

72-
# install the JupyterLab extensions
73-
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipylab bqplot ipytree
74-
7566
# start JupyterLab
7667
jupyter lab
7768
```
@@ -86,19 +77,19 @@ jupyter lab
8677

8778
```bash
8879
# create a new conda environment
89-
conda create -n ipylab -c conda-forge jupyterlab nodejs
80+
mamba create -n ipylab -c conda-forge jupyter-packaging nodejs python -y
9081

9182
# activate the environment
9283
conda activate ipylab
9384

9485
# install the Python package
9586
python -m pip install -e ".[dev]"
9687

88+
# link the extension files
89+
jupyter labextension develop . --overwrite
90+
9791
# compile the extension
9892
jlpm && jlpm run build
99-
100-
# install the widgets extension and the ipylab extension locally
101-
jupyter labextension install @jupyter-widgets/jupyterlab-manager . --debug
10293
```
10394

10495
## Related projects

ipylab/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@
44
# Copyright (c) ipylab contributors.
55
# Distributed under the terms of the Modified BSD License.
66

7+
import json
8+
import os.path as osp
9+
710
from .jupyterfrontend import JupyterFrontEnd
811
from .widgets import Panel, SplitPanel
912

1013
from ._version import __version__, version_info
14+
15+
HERE = osp.abspath(osp.dirname(__file__))
16+
17+
with open(osp.join(HERE, "labextension", "package.json")) as fid:
18+
data = json.load(fid)
19+
20+
21+
def _jupyter_labextension_paths():
22+
return [{"src": "labextension", "dest": data["name"]}]

ipylab/shell.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ def add(self, widget, area, args=None):
3030

3131
def expand_left(self):
3232
self.send(
33-
{"func": "expandLeft", "payload": {},}
33+
{
34+
"func": "expandLeft",
35+
"payload": {},
36+
}
3437
)
3538

3639
def expand_right(self):
3740
self.send(
38-
{"func": "expandRight", "payload": {},}
41+
{
42+
"func": "expandRight",
43+
"payload": {},
44+
}
3945
)

0 commit comments

Comments
 (0)