Home

Awesome

widget-cookiecutter (deprecated)

This cookitcutter template is now deprecated

We recommend anywidget as an alternative for those who want to learn or quickly prototype widgets. For production uses, we recommend the TypeScript cookiecutter

A cookiecutter template for creating a custom Jupyter widget project

Documentation Status Join the chat at https://gitter.im/jupyter-widgets/Lobby

A cookiecutter template for a custom Jupyter widget project.

What is widget-cookiecutter?

With widget-cookiecutter you can create a custom Jupyter interactive widget project with sensible defaults. widget-cookiecutter helps custom widget authors get started with best practices for the packaging and distribution of a custom Jupyter interactive widget library.

Who uses widget-cookiecutter

Popular widget libraries such as bqplot, pythreejs and ipyleaflet can serve as advanced examples of usage of the Jupyter widget infrastructure.

Usage

Install cookiecutter:

$ pip install cookiecutter

After installing cookiecutter, use the widget-cookiecutter:

$ cookiecutter https://github.com/jupyter/widget-cookiecutter.git

As widget-cookiecutter runs, you will be asked for basic information about your custom Jupyter widget project. You will be prompted for the following information:

After this, you will have a directory containing files used for creating a custom Jupyter widget. You will now be able to easily package and distribute your custom Jupyter widget.

Files Generated by cookiecutter

Jupyter widgets are composed of two separate programs:

This cookiecutter generates example source files for both the backend and frontend programs, as well as the tooling to develop and publish the widget in the classic notebook, JupyterLab and in stand-alone HTML pages.

Running the cookiecutter generates the following file tree:

├── <python_package_name>
│   ├── __init__.py
│   ├── _version.py
│   └── example.py
├── js
│   ├── lib
│   │   ├── embed.js
│   │   ├── example.js
│   │   ├── extension.js
│   │   ├── index.js
│   │   └── labplugin.js
│   ├── package.json
│   ├── README.md
│   └── webpack.config.js
├── .gitignore
├── <npm_package_name>.json
├── MANIFEST.in
├── README.md
├── RELEASE.md
├── setup.cfg
└── setup.py

Local Dev Installation for Classic Notebook

To develop this package against the classic notebook, run:

Now make some changes to your source code. Then:

Local Dev Installation for JupyterLab

To develop this package against JupyterLab, run:

Now make some changes to your source code. Then:

Publishing Widget

Follow the steps in (RELEASE.md) to publish widget python package and npm packages.

Widget Installation Process for Notebook

When installing published package in non-development mode

Widget Load Process for Notebook

More information