GitHub - jupyterlab/extension-examples at 1.x (original) (raw)

JupyterLab Extensions by Examples

Github Actions Status Binder

TL;DR

The goal of this repository is to show how to develop extensions for JupyterLab, presented as short tutorial series.

To get started:

git clone https://github.com/jtpio/jupyterlab-extension-examples.git && cd jupyterlab-extension-examples &&
conda env create &&
conda activate jupyterlab-extension-examples &&
cd basics/hello-world &&
jlpm &&
jlpm run build &&
jupyter labextension link .

In another terminal

jupyter lab --watch

Develop by Examples

You may find it easier to learn how to create extensions by examples, instead of going through the documentation.

Start with the Hello World and then jump to the topic you are interested in.

You can expect from each example:

We have structured the examples based on the extension points. Browse the previews below or skip them and jump directly to the sections for developers.

Basic

Hello World

Hello World

Signals

Button with Signal

Datagrid

Datagrid |

Command Palette

Command Palette

Commmand Palette

Commands

Commands

Commmand example

Launcher

Launcher

Launcher

Main Menu

Settings

Settings

Settings

State

State

State

React

React Widget

react-widget

Widget Tracker

Widgets

Custom Tab

Advanced

Kernel Output

OutputArea class

Kernel Messaging

Kernel Messages

Server Hello World

Server Hello World

Prerequisites

Writing an extension requires basic knowledge of JavaScript, Typescript and potentially Python.

Don't be scared of Typescript, even if you never coded in TypeScript before you touch JupyterLab you may find it easier to understand than pure JavaScript if you have a basic understanding of object oriented programming and types.

These examples are developed and tested on top of JupyterLab version 1.2. You can create a conda environment to get started.

conda env create &&
conda activate jupyterlab-extension-examples

Develop and Use the Examples

jlpm jlpm build-ext jlpm link-ext jlpm build-jlab jupyter lab

To clean the lib folders:

Go to the example directory you want to install, e.g. cd ./basics/hello-world, and run the following commands:

jlpm install jlpm run build jupyter labextension link .

Rebuild the JupyterLab application:

jlpm run build jupyter lab build

Start JupyterLab in watch mode:

Install a Published Extension

Once your extension is published (outside of this scope), you can install it with the following command:

jupyter labextension install

About JupyterLab

JupyterLab can be used as a platform to combine existing data-science components into a new powerful application that can be deployed remotely to many users. Some of the higher level components that can be used are text editors, terminals, notebooks, interactive widgets, filebrowser, renderers for different file formats that provide access to an enormous ecosystem of libraries from different languages.

JupyterLab Documentation

Complementary to these examples, you can rely on the official JupyterLab documentation.

Credits

We would like to thank MMesch for initiating this work, as well as everyone else who contributed!