-
Notifications
You must be signed in to change notification settings - Fork 1
Home
-
Run
cookiecutter https://github.com/jupyter/widget-cookiecutter.git
and fill out details -
cd <npm_package_name>
wherenpm_package_name
is from the details in step 1 -
python setup.py build; pip install -e .
-
pip install -e .
-
jupyter nbextension install --py --symlink --sys-prefix <python_package_name>
-
jupyter nbextension enable --py --sys-prefix <python_package_name>
-
Must also install lab extension:
cd js; jupyter labextension install .
-
Create python file and matching js file (expand on this) Coding the widget
after changes to javascript (otherwise changes do not get picked up):
-
jupyter nbextension uninstall --py --sys-prefix <python_package_name>
-
jupyter nbextension install --py --symlink --sys-prefix <python_package_name>
-
jupyter nbextension enable --py --sys-prefix <python_package_name>
-
jupyter lab clean; jupyter lab build
Must restart jupyter afterwards
Notes:
-
require('vtk.js');
NOTvar vtk = require('vtk.js');
BUT must usevar $ = require('jquery');
-
After mac crash /home/vagrant/.pyenv/versions/3.7.2/envs/py3/share/jupyter/lab/static/package.jon was empty. Run
pip install --upgrade --no-deps --ignore-installed jupyterlab
to get it back -
Must install @jupyter-widgets/controls in order to subclass widgets:
npm install --save @jupyter-widgets/controls
-
in widget js:
let controls = require('@jupyter-widgets/controls');
-
Must invoke super.render in this roundabout way (from Backbone.js):
controls.<super class>.prototype.render.apply((this));
-
When including multiple js files in jupyter package, embed.js and index.js should set exports thus:
module.exports = Object.assign(
require('./<js file 1>.js'),
require('./<js file 1>.js'),
...
);