Skip to content

Commit 99cf7f4

Browse files
committed
JupyterLab 3 build
Signed-off-by: martinRenou <[email protected]>
1 parent 0d928b6 commit 99cf7f4

10 files changed

+2069
-90
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ build/
66
node_modules/
77

88
# Generated Javascript
9-
ipympl/static/
10-
ipympl/staticlab/
9+
ipympl/nbextension/
10+
ipympl/labextension/
1111
ipympl/*.tgz
1212
js/*.tgz
1313

.travis.yml

+24-21
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,29 @@ cache:
77
directories:
88
- $HOME/.npm
99
before_install:
10-
- wget https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-linux64.tar.gz
11-
- mkdir geckodriver
12-
- tar -xzf geckodriver-v0.11.1-linux64.tar.gz -C geckodriver
13-
- export PATH=$PATH:$PWD/geckodriver
14-
- export DISPLAY=:99.0
15-
- sh -e /etc/init.d/xvfb start || true
10+
- wget https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-linux64.tar.gz
11+
- mkdir geckodriver
12+
- tar -xzf geckodriver-v0.11.1-linux64.tar.gz -C geckodriver
13+
- export PATH=$PATH:$PWD/geckodriver
14+
- export DISPLAY=:99.0
15+
- sh -e /etc/init.d/xvfb start || true
1616
install:
17-
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
18-
- bash miniconda.sh -b -p $HOME/miniconda
19-
- export PATH="$HOME/miniconda/bin:$PATH"
20-
- hash -r
21-
- conda config --set always_yes yes --set changeps1 no
22-
- conda update -q conda
23-
- conda info -a
24-
- conda install -c conda-forge nodejs=13 notebook matplotlib ipywidgets jupyterlab
25-
- pip install -v .
17+
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
18+
- bash miniconda.sh -b -p $HOME/miniconda
19+
- export PATH="$HOME/miniconda/bin:$PATH"
20+
- hash -r
21+
- conda config --set always_yes yes --set changeps1 no
22+
- conda update -q conda
23+
- conda info -a
24+
- conda install -c conda-forge mamba
25+
- mamba install -c conda-forge nodejs=13 matplotlib
26+
- mamba install jupyterlab=3 ipywidgets jupyterlab_widgets -c conda-forge/label/jupyterlab_rc -c conda-forge/label/jupyterlab_server_rc -c conda-forge/label/jupyterlab_widgets_rc -c conda-forge
27+
- pip install .
2628
script:
27-
- jupyter nbextension install --py --symlink --sys-prefix ipympl
28-
- jupyter nbextension enable --py --sys-prefix ipympl
29-
- jupyter labextension list 2>&1 | grep -q jupyter-matplotlib
30-
- jupyter labextension install @jupyter-widgets/jupyterlab-manager
31-
- jupyter labextension link js
32-
- python -m jupyterlab.browser_check --NotebookApp.ip=127.0.0.1
29+
- test -d $HOME/miniconda/share/jupyter/nbextensions/jupyter-matplotlib
30+
- test -f $HOME/miniconda/share/jupyter/nbextensions/jupyter-matplotlib/extension.js
31+
- test -f $HOME/miniconda/share/jupyter/nbextensions/jupyter-matplotlib/index.js
32+
- test -d $HOME/miniconda/share/jupyter/labextensions/jupyter-matplotlib
33+
- test -f $HOME/miniconda/share/jupyter/labextensions/jupyter-matplotlib/package.json
34+
- jupyter labextension list 2>&1 | grep -q jupyter-matplotlib
35+
- python -m jupyterlab.browser_check --NotebookApp.ip=127.0.0.1

MANIFEST.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
recursive-include ipympl/static *.*
1+
recursive-include ipympl/nbextension *.*
2+
recursive-include ipympl/labextension *.*
23

34
include js/*.tgz
45
include js/package.json

README.md

+2-41
Original file line numberDiff line numberDiff line change
@@ -39,48 +39,9 @@ conda install -c conda-forge ipympl
3939
pip install ipympl
4040
```
4141

42-
### Install the JupyterLab extension
42+
### Use in JupyterLab
4343

44-
In order to install the JupyterLab extension `jupyter-matplotlib`, you will first need to install `nodejs`, you can install it with `conda` doing
45-
46-
```bash
47-
conda install -c conda-forge nodejs
48-
```
49-
50-
Starting from ipympl `0.5.6`, **you do not need to manually install the JupyterLab extension**, but you still need to install the JupyterLab widget manager:
51-
```bash
52-
jupyter labextension install @jupyter-widgets/jupyterlab-manager
53-
54-
# If you already installed the @jupyter-widgets/jupyterlab-manager extension, you will still need to rebuild JupyterLab after you installed ipympl
55-
jupyter lab build
56-
```
57-
58-
#### Install an old JupyterLab extension
59-
60-
You will need to install the right `jupyter-matplotlib` version, according to the `ipympl` and `jupyterlab` versions you installed.
61-
For example, if you installed ipympl `0.5.1`, you need to install jupyter-matplotlib `0.7.0`, and this version is only compatible with JupyterLab `1`.
62-
63-
```bash
64-
conda install -c conda-forge ipympl==0.5.1
65-
jupyter labextension install @jupyter-widgets/jupyterlab-manager [email protected]
66-
```
67-
68-
Versions lookup table:
69-
70-
71-
| `ipympl` | `jupyter-matplotlib` | `JupyterLab` | `Matplotlib` |
72-
|----------|----------------------|--------------|--------------|
73-
| 0.5.8 | 0.7.4 | 1 or 2 | 3.3.1 |
74-
| 0.5.7 | 0.7.3 | 1 or 2 | 3.2.* |
75-
| ... | ... | ... | |
76-
| 0.5.3 | 0.7.2 | 1 or 2 | |
77-
| 0.5.2 | 0.7.1 | 1 | |
78-
| 0.5.1 | 0.7.0 | 1 | |
79-
| 0.5.0 | 0.6.0 | 1 | |
80-
| 0.4.0 | 0.5.0 | 1 | |
81-
| 0.3.3 | 0.4.2 | 1 | |
82-
| 0.3.2 | 0.4.1 | 1 | |
83-
| 0.3.1 | 0.4.0 | 0 or 1 | |
44+
If you want to use ipympl in JupyterLab, we recommend using JupyterLab >= 3.
8445

8546
### For a development installation (requires nodejs):
8647

ipympl/__init__.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@
44
npm_pkg_name = 'jupyter-matplotlib'
55

66

7+
def _jupyter_labextension_paths():
8+
return [{
9+
'src': 'labextension',
10+
'dest': npm_pkg_name
11+
}]
12+
13+
714
def _jupyter_nbextension_paths():
815
return [{
916
'section': 'notebook',
10-
'src': 'static',
17+
'src': 'nbextension',
1118
'dest': npm_pkg_name,
1219
'require': npm_pkg_name + '/extension'
1320
}]

0 commit comments

Comments
 (0)