An extension for testing whether the output of a cell in a Jupyter notebook has changed (meaning if it is different from a previously saved desired output).
$ sudo apt-get install npm
$ git clone https://github.com/dkrenn/jupyter-nbcelltesting.git
$ cd jupyter-nbcelltesting
$ npm install
$ PYFLAG=--user npm run install-nbcelltesting
After cloning this repository, the required JavaScript dependencies have to be
installed with the help of npm
:
$ npm install
Afterwards, the extension has to be installed an enabled for your jupyter-notebook. To do so, you have two options:
- Automatically via our
install-nbcelltesting
script fornpm
by calling
$ npm run install-nbcelltesting
Note that when following this approach, you can configure the level to which the
extension should be installed with the environment variable $PYFLAG
, which can
be set to
--user
to install into the user's home Jupyter directories--system
to install into the system-wide Jupyter directories--sys-prefix
to install into Python'ssys.prefix
(useful e.g. for virtualenvs)--symlink
to symlink this extension instead of copying the files--debug
for more-verbose output
The npm
script passes $PYFLAG
then to the calls to jupyter-nbextension install
and jupyter-nbextension enable
, as explained below. For example,
$ PYFLAG=--user npm run install-nbcelltesting
installs the extension into the user's home Jupyter directory.
- Manually via
jupyter-nbextension install / enable
. You have to install and then enable the extension viaSee the Jupyter notebook documentation for more information.$ jupyter-nbextension install path/to/nbcelltesting/ $ jupyter-nbextension enable nbcelltesting/main $ jupyter-nbextension enable nbcelltesting/resources/diff.min
After successfully installing the extension, fire up the notebook server (jupyter-notebook
), open a file and
select Cell Testing
from the CellToolbar dropdown menu (View > Cell Toolbar > Cell Testing
).
Congratulations, you are now using the celltesting
-extension!