Interactive HTML widgets for Jupyter notebooks and the IPython kernel.
A demonstration notebook provides an overview of the interactive widgets. For detailed information, please refer to the ipywidgets documentation.
Compatibility
ipywidgets version | Jupyter/notebook version |
---|---|
master | master |
4.1.x | 4.1 |
4.0.x | 4.0 |
Install the current version of ipywidgets using pip or conda:
pip install ipywidgets
or
conda install ipywidgets
If you're interested in only installing the JavaScript, you may do so by running
npm install jupyter-js-widgets
To install ipywidgets from git, you will need npm and the latest development copy of the Jupyter notebook because everything in the ipywidgets repository is developed using Jupyter notebook master. If you want to have a copy of ipywidgets that works against a stable version of the notebook, checkout the appropriate tag (see the Compatibility table above).
If you install using sudo, you need to make sure that npm is also available in the PATH used with sudo.
-
clone the repo:
git clone https://github.com/ipython/ipywidgets cd ipywidgets
-
Dev-install of the package (run from repo directory):
pip install -v -e .
-
Build the Jupyter Widgets package
cd jupyter-js-widgets npm install cd ..
-
Install the Jupyter Widgets nbextension
cd widgetsnbextension npm install npm run update:widgets pip install -v -e . cd ..
After you've made changes to jupyter-js-widgets
and you'd like to test those
changes, run the following, empty your browsers cache, and refresh the page.
cd widgetsnbextension
npm run update:widgets
cd ..
TIPS: If you have any problems with the above install procedure, make sure that
permissions on npm and pip related install directories are correct. Sometimes
it helps to clear cached files too by running git clean -dfx
. Also, when
you make changes to the Javascript, if you're not seeing the changes it could
be your browser caching aggressively. Try using "incognito" or "private"
browsing tabs to avoid caching.
To run the Python tests:
nosetests --with-coverage --cover-package=ipywidgets ipywidgets
To run the Javascript tests:
cd jupyter-js-widgets; npm run test
This will run the test suite using karma
with 'debug' level logging.