Skip to content

Commit ca150e6

Browse files
committed
Updates to project structure to make it compatible with newer versions of jupyter-notebook, jupyter-lab and ipywidgets
1 parent 2a6281a commit ca150e6

File tree

14 files changed

+2668
-1498
lines changed

14 files changed

+2668
-1498
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ node_modules/
77
pip-wheel-metadata/
88

99
# Compiled javascript
10-
neurolang_ipywidgets/static/
10+
neurolang_ipywidgets/nbextension/
11+
neurolang_ipywidgets/labextension/
1112

1213
# OS X
1314
.DS_Store

MANIFEST.in

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
graft neurolang_ipywidgets/nbextension
2+
graft neurolang_ipywidgets/labextension
3+
4+
graft js
5+
graft tests
6+
prune **/node_modules
7+
18
recursive-include neurolang_ipywidgets/static *.*
29
include neurolang-ipywidgets.json
310
recursive-include neurolang_ipywidgets/data *.*
11+
12+
include LICENSE
13+
include setup.py
14+
include pyproject.toml
15+
include install.json
16+
17+
# Patterns to exclude from any directory
18+
global-exclude *~
19+
global-exclude *.pyc
20+
global-exclude *.pyo
21+
global-exclude .git
22+
global-exclude .ipynb_checkpoints
23+
global-exclude *.map

README.md

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,22 @@ Installation
99
To install use pip:
1010

1111
$ pip install neurolang_ipywidgets
12-
$ jupyter nbextension enable --py --sys-prefix neurolang_ipywidgets
13-
14-
To install for jupyterlab:
1512

16-
$ jupyter labextension install neurolang_ipywidgets
17-
18-
> To be able to run extensions in jupyterlab:
19-
>
20-
> $ jupyter labextension install @jupyter-widgets/jupyterlab-manager
21-
>
22-
> This should be installed before installing neurolang_ipywidgets
23-
24-
For a development installation (requires npm),
13+
For a development installation (requires [Node.js](https://nodejs.org) and [Yarn version 1](https://classic.yarnpkg.com/)),
2514

2615
$ git clone https://github.com/NeuroLang/neurolang_ipywidgets.git
2716
$ cd neurolang_ipywidgets
2817
$ pip install -e .
29-
$ jupyter nbextension install --py --symlink --sys-prefix neurolang_ipywidgets
18+
$ jupyter nbextension install --py --symlink --overwrite --sys-prefix neurolang_ipywidgets
3019
$ jupyter nbextension enable --py --sys-prefix neurolang_ipywidgets
31-
$ jupyter labextension install js
32-
33-
When actively developing your extension, build Jupyter Lab with the command:
3420

35-
$ jupyter lab --watch
36-
37-
This take a minute or so to get started, but then allows you to hot-reload your javascript extension.
38-
To see a change, save your javascript, watch the terminal for an update.
21+
When actively developing your extension for JupyterLab, run the command:
3922

40-
Note on first `jupyter lab --watch`, you may need to touch a file to get Jupyter Lab to open.
23+
$ jupyter labextension develop --overwrite neurolang_ipywidgets
4124

42-
Using notebook:
43-
$ jupyter notebook
44-
45-
- After making Python code changes, restarting the notebook kernel will be enough to reflect changes
46-
- After making JavaScript code changes:
25+
Then you need to rebuild the JS when you make a code change:
4726

48-
* cd js
49-
* npm run build
50-
* Refresh browser to reflect changes
27+
$ cd js
28+
$ yarn run build
5129

30+
You then need to refresh the JupyterLab page when your javascript changes.

examples/nldownloadlink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: light
77
# format_version: '1.5'
8-
# jupytext_version: 1.5.1
8+
# jupytext_version: 1.11.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# language: python

examples/nlpapayaviewer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@
4949
# ## Reset viewer
5050

5151
nl.reset()
52+
53+

examples/nlvboxoverlay.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,6 @@
100100
)
101101
# vb.layout = vb_layout
102102
vb
103+
# -
104+
105+

install.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"packageManager": "python",
3+
"packageName": "neurolang_ipywidgets",
4+
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package neurolang_ipywidgets"
5+
}

js/lib/labplugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var plugin = require('./index');
22
var base = require('@jupyter-widgets/base');
33

44
module.exports = {
5-
id: 'neurolang-ipywidgets',
5+
id: 'neurolang-ipywidgets:plugin',
66
requires: [base.IJupyterWidgetRegistry],
77
activate: function(app, widgets) {
88
widgets.registerWidget({

0 commit comments

Comments
 (0)