Introducing JupyterLab

JupyterLab is the next generation of the Jupyter Notebook. It aims at fixing many Notebook usability issues and it greatly expands its scope. JupyterLab offers a general framework for interactive computing and data science in the browser, using Python, Julia, R, or one of many other languages.

In addition to providing an improved interface to existing notebooks, JupyterLab also brings, within the same interface, a file browser, consoles, terminals, text editors, Markdown editors, CSV editors, JSON editors, interactive maps, widgets, and so on. The architecture is completely extensible and open to developers. In a word, JupyterLab is a web-based, hackable IDE for data science and interactive computing.

JupyterLab uses the exact same Notebook server and file format as the classic Jupyter Notebook, so that it is fully compatible with existing notebooks and kernels. Notebook and JupyterLab can run side to side on the same computer. You can easily switch between the two interfaces.

Note

At the time of writing, JupyterLab is still in an early stage of development. However, it is already fairly usable. The interface may change until the production release. The developer API used to customize JupyterLab is still not stable. There is no user documentation yet.

Getting ready

To install JupyterLab, type conda install -c conda-forge jupyterlab in a Terminal.

To be able to render GeoJSON files in an interactive map, install the GeoJSON JupyterLab extension with: jupyter labextension install @jupyterlab/geojson-extension.

How to do it...

  1. We can launch JupyterLab by typing jupyter lab in a Terminal. Then we go to http://localhost:8888/lab in the web browser.
  2. The dashboard shows, on the left, a list of files and subdirectories in the current working directory. On the right, the launcher lets us create notebooks and text files, or open a Jupyter console or a Terminal. Available Jupyter kernels are automatically displayed (here, IPython, but also IR and IJulia).
    How to do it...

    JupyterLab home

  3. On the left panel, we can also see a list of open tabs, a list of running sessions, or a list of available commands:
    How to do it...

    Running sessions

    How to do it...

    Available commands

  4. If we open a Jupyter notebook, we get an interface that closely resembles the classic Notebook interface:
    How to do it...

    A notebook

    There are a few improvements compared to the classic Notebook. For example, we can drag and drop one or several cells:

    How to do it...

    Drag and drop in the notebook

    We can also collapse cells.

  5. If we right-click in the notebook, a contextual menu appears:
    How to do it...

    Contextual menu in the notebook

    If we click on Create Console for Notebook, a new tab appears with a standard IPython console. We can drag and drop the tab anywhere in the screen, for example below the notebook panel:

    How to do it...

    Notebook and console

    The IPython console is connected to the same kernel as the Notebook, so they share the same namespace. We can also open a new IPython console from the launcher, running in a separate kernel.

  6. We can also open a system shell directly in the browser, using the term.js library:
    How to do it...

    Notebook and shell

  7. JupyterLab includes a text editor. We can create a new text file from the launcher, rename it by giving it the .md extension, and edit it:
    How to do it...

    Markdown document

    Let's right-click on the Markdown file. A contextual menu appears:

    How to do it...

    Contextual menu in a Markdown file

    We can add a new panel that renders the Markdown file in real time:

    How to do it...

    Markdown rendered

    We can also attach an IPython console to our Markdown file. By clicking within a code block and pressing Shift + Enter, we send the code directly to the console:

    How to do it...

    Markdown and console

  8. We can also create and open CSV files in JupyterLab:
    How to do it...

    CSV file

    The CSV viewer is highly efficient. It can smoothly display huge tables with millions or even billions of values:

    How to do it...

    Viewing a CSV file

  9. GeoJSON files (files that contain geographic information) can also be edited or viewed with the Leaflet mapping library:
    How to do it...
    How to do it...

There's more...

JupyterLab is fully extendable. In fact, its philosophy is that all existing features are implemented as plugins.

It is possible to work collaboratively on a notebook, as with Google Docs. This feature is still in active development at the time of writing.

Here are a few references:

See also

  • The Introducing IPython and the Jupyter Notebook recipe in Chapter 1, A Tour of Interactive Computing with Jupyter and IPython