Skip to content

Commit 7967ba8

Browse files
authored
Merge pull request #296 from martinRenou/lab2
Fix JupyterLab 2 and use yarn
2 parents ac0a7c3 + 5c44901 commit 7967ba8

File tree

7 files changed

+3195
-12625
lines changed

7 files changed

+3195
-12625
lines changed

.github/workflows/main.yml

Lines changed: 101 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ on:
88
branches:
99
- master
1010

11+
defaults:
12+
run:
13+
shell: bash -l {0}
14+
1115
jobs:
1216
run:
1317
runs-on: ${{ matrix.os }}
1418

1519
strategy:
1620
fail-fast: false
1721
matrix:
18-
os: [ubuntu-latest, macos-latest]
19-
python-version: [3.7, 3.8]
22+
os: [ubuntu-latest]
23+
python-version: [3.8]
2024

2125
steps:
2226
- name: Checkout
@@ -25,19 +29,17 @@ jobs:
2529
- name: Setup conda
2630
uses: conda-incubator/setup-miniconda@v2
2731
with:
32+
activate-environment: ipympl-dev
33+
environment-file: dev-environment.yml
34+
python-version: ${{ matrix.python-version }}
2835
mamba-version: "*"
36+
auto-activate-base: false
2937
channels: conda-forge
3038

31-
- name: Mamba install dependencies
32-
shell: bash -l {0}
33-
run: mamba install python=${{ matrix.python-version }} pip nodejs ipywidgets=7.6 jupyter jupyterlab=3 pillow numpy matplotlib flake8 pytest nbval
34-
3539
- name: Install ipympl
36-
shell: bash -l {0}
3740
run: pip install -e .
3841

3942
- name: Check installation files
40-
shell: bash -l {0}
4143
run: |
4244
test -d $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib
4345
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib/extension.js
@@ -46,22 +48,109 @@ jobs:
4648
test -f $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib/package.json
4749
4850
- name: Check nbextension and labextension
49-
shell: bash -l {0}
5051
run: |
5152
jupyter nbextension list 2>&1 | grep -ie "jupyter-matplotlib/extension.*enabled" -
5253
jupyter labextension list 2>&1 | grep -ie "jupyter-matplotlib.*enabled.*ok" -
5354
5455
- name: Run tests
55-
shell: bash -l {0}
5656
run: pytest .
5757

5858
- name: Test flake8
59-
shell: bash -l {0}
6059
run: flake8 ipympl --ignore=E501,W504,W503
6160

6261
- name: Test JS linters
63-
shell: bash -l {0}
6462
working-directory: js
6563
run: |
6664
npm run eslint:check
6765
npm run prettier:check
66+
67+
build:
68+
runs-on: ubuntu-latest
69+
steps:
70+
71+
- name: Checkout
72+
uses: actions/checkout@v2
73+
74+
- name: Setup conda
75+
uses: conda-incubator/setup-miniconda@v2
76+
with:
77+
activate-environment: ipympl-dev
78+
environment-file: dev-environment.yml
79+
python-version: ${{ matrix.python-version }}
80+
mamba-version: "*"
81+
auto-activate-base: false
82+
channels: conda-forge
83+
84+
- name: Build packages
85+
run: |
86+
python setup.py sdist bdist_wheel
87+
cd dist
88+
sha256sum * | tee SHA256SUMS
89+
90+
- name: Upload builds
91+
uses: actions/upload-artifact@v2
92+
with:
93+
name: dist ${{ github.run_number }}
94+
path: ./dist
95+
96+
install:
97+
runs-on: ${{ matrix.os }}-latest
98+
needs: [build]
99+
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
os: [ubuntu, macos]
104+
python: ['3.6', '3.9']
105+
include:
106+
- python: '3.6'
107+
dist: 'ipympl*.tar.gz'
108+
jlab_version: 3
109+
- python: '3.9'
110+
dist: 'ipympl*.whl'
111+
jlab_version: 2
112+
113+
steps:
114+
115+
- name: Checkout
116+
uses: actions/checkout@v2
117+
118+
- name: Setup conda
119+
uses: conda-incubator/setup-miniconda@v2
120+
with:
121+
python-version: ${{ matrix.python-version }}
122+
mamba-version: "*"
123+
auto-activate-base: false
124+
channels: conda-forge
125+
126+
- name: Install dependencies
127+
run: mamba install python=${{ matrix.python-version }} pip yarn jupyterlab=${{ matrix.jlab_version }} ipywidgets jupyter-packaging
128+
129+
- uses: actions/download-artifact@v2
130+
with:
131+
name: dist ${{ github.run_number }}
132+
path: ./dist
133+
134+
- name: Install the package
135+
run: |
136+
cd dist
137+
pip install -vv ${{ matrix.dist }}
138+
139+
- name: Manually install labextension for lab2
140+
if: ${{ matrix.jlab_version }} == 2
141+
run: jupyter labextension install js
142+
143+
- name: Test installation files
144+
run: |
145+
test -d $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib
146+
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib/extension.js
147+
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-matplotlib/index.js
148+
test -d $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib
149+
test -f $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib/package.json
150+
test -d $CONDA_PREFIX/share/jupyter/labextensions/jupyter-matplotlib/static
151+
152+
- name: Validate the nbextension
153+
run: jupyter nbextension list 2>&1 | grep "jupyter-matplotlib/extension"
154+
155+
- name: Validate the labextension
156+
run: jupyter labextension list 2>&1 | grep jupyter-matplotlib

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ pip install ipympl
4343

4444
If you want to use ipympl in JupyterLab, we recommend using JupyterLab >= 3.
4545

46+
If you use JupyterLab 2, you still need to install the labextension manually:
47+
48+
```bash
49+
conda install -c conda-forge nodejs
50+
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
51+
```
52+
4653
#### Install an old JupyterLab extension
4754

4855
If you are using JupyterLab 1 or 2, you will need to install the right `jupyter-matplotlib` version, according to the `ipympl` and `jupyterlab` versions you installed.

dev-environment.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: ipympl-dev
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- pip
6+
- yarn
7+
- jupyter-packaging
8+
- jupyterlab=3
9+
- ipywidgets>=7.6
10+
- flake8
11+
- pillow
12+
- numpy
13+
- matplotlib
14+
- pytest
15+
- nbval

0 commit comments

Comments
 (0)