notebook/binder/example.ipynb
2020-12-11 00:44:29 +01:00

749 KiB

Welcome to JupyterLab Classic! 👋

JupyterLab Classic is an alternative distribution of JupyterLab. It is built using the same components as in JupyterLab, and reuse a lot of the work from the JupyterLab community by leveraging the new federated (prebuilt) extension system.

The goal of JupyterLab Classic is to provide an interface focused on the notebook for users that would like a leaner and simpler interface with a modern look and old school touch to it.

It is supposed to complement JupyterLab and its single document mode, not to replace it! All these different interfaces can perfectly be installed together in the same environment:

  • JupyterLab (jupyterlab package)
  • NBClassic (nbclassic package): provides the Classic Notebook interface formely developed in https://github.com/jupyter/notebook
  • JupyterLab Classic (jupyterlab-classic package): the interface you are probably currently using if looking at this notebook :)

Files 📂 and Running Sessions 🏃‍♀️

Just like in the classic notebook, JupyterLab Classic lets you navigate the files in a separate browser tab.

Go ahead and click on the Jupyter icon in the top left corner!

image.png

It will open a new browser tab with the listing of the files on the server:

image.png

It also shows the list of running sessions and terminals in the Running tab:

image.png

Alternatively it is also possible to access this page using the command in the View menu:

image.png

Editing Files 🖊️

JupyterLab Classic also has support for editing files. Double-click on a file (or Right Click > Open) to open the editor:

image.png

image.png

Terminals 🖥️

To create a new Terminal, select File > New > Terminal in the menu:

image.png

The terminal opens in a new browser tab:

image.png

Command Palette 🎨

JupyterLab Classic includes a command palette, just like in JupyterLab.

Hit Ctrl-Shift-C or Accel-Shift-C to activate it. Or via the menu with View > Activate Command Palette:

image.png

Using the palette is very convenient and can give a significant productivity boost over time!

Themes 🌈

Since JupyterLab Classic is heavily built on top of JupyterLab, it also has support for a Dark Mode! 🕶️

Go to Settings > JupyterLab Theme > JupyterLab Dark to select the theme:

image.png

New themes can be installed using the federated extension system. These themes will be compatible with both JupyterLab and JupyterLab Classic.

Zen Mode 😌

This is an exclusivity in JupyterLab Classic 😎

Activate the palette and choose Toggle Zen Mode. The interface will focus on the notebook and the notebook only!

image.png

Press Escape to exit, or re-run the Toggle Zen Mode command from the palette.

Third Party Extensions 🧩

JupyterLab Classic supports third-party extensions developed for JupyterLab 3.0+, using the new distribution system. These extensions can be installed via pip.

For example the extension to enable Jupyter Widgets rendering in both JupyterLab and JupyterLab Classic can be installed using the following command (run the cell):

In [ ]:
!pip install --pre jupyterlab_widgets

Now reload the page and resume from here. In the next section we will be able to create and use Jupyter Widgets!

Widgets

Now let's instantiate a new widget:

In [ ]:
from ipywidgets import IntSlider
slider = IntSlider()
slider
In [ ]:
slider

Rich Display

Just like in many Jupyter Frontends, JupyterLab Classic supports rich display rendering. For example:

In [ ]:
from IPython.display import Latex
Latex(r"""\begin{eqnarray}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0 
\end{eqnarray}""")

Matplotlib figures:

In [ ]:
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)

plt.plot(x, np.sin(x))
plt.plot(x, np.cos(x))

plt.show()

Or even HTML:

In [ ]:
from IPython.display import HTML
from IPython.display import display

s = """<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>"""
h = HTML(s)
display(h)

That's it!

Hope you enjoyed the tour. If you have more question or any other issues, don't hesitate to go to the repository on GitHub!

https://github.com/jtpio/jupyterlab-classic