Jupyter Lab is one of the most widely used IDEs in the data science community. They are the choice of tool for many data scientists when it comes to quick prototyping and exploratory analysis. A JupyterLab neatly bundles many functionalities together, enabling collaborative, extensible, and scalable data science. However, this article is not about the various advantages of the Jupyter Lab. I believe there are a plethora of resources on that topic. Instead, the focus here will be on one of the useful components of JupyterLab called Extensions. These extensions are pretty helpful and can enhance a person’s productivity when working alone or in a team. Let’s start by understanding what an extension is, and then we’ll quickly go through some of the useful JupyterLab extensions currently available on Github.
“Extensions can add items to the menu or command palette, keyboard shortcuts, or settings in the settings system. Extensions can provide an API for other extensions to use and can depend on other extensions. In fact, the whole of JupyterLab itself is simply a collection of extensions that are no more powerful or privileged than any custom extension.”
In this article, we’ll look at some of the useful extensions and how they can enhance our experience while working with the jupyter lab. But before we begin, let’s quickly look at how we can install these extensions. To install JupyterLab extensions, you need to have Node.js installed, either directly installed from the Node.js website or as follows.
conda install -c conda-forge nodejs
or# For Mac OSX users
brew install node
Once installed, it appears as a new icon in the JupyterLab sidebar.
To manage the various extensions, we can use the extension manager. By default, the manager is disabled but can be enabled by clicking on the enable button.
Alternatively, you can search for the Extension Manager in the command palette and enable it there also.
Useful JupyterLab Extensions
Let’s now take a tour of some of the useful extensions available currently in JupyterLab. Please keep in mind that these are third party extensions and are not reviewed. Some extensions may introduce security risks or contain malicious code that runs on your machine.
You can search for the desired extension in the extension manager. While searching, you’ll notice that some of these extensions have a Jupyter icon next to their name. These extensions are released by the Jupyter organization and are always placed first.
1️⃣ . Jupyterlab Google Drive
As the name suggests, the jupyterlab-google-drive extension provides cloud storage for the JupyterLab via the google drive. Once installed, this extension adds a Google Drive file browser to the left side panel of JupyterLab. You need to be logged into your google account to access the files stored in your google drive through JupyterLab.
Installation: Through Extension Manager
You can install the extension via the extension manager. Search for the name of the extension in the search bar and install it.
You will then need to restart the environment. Once you do so, you will be greeted with the following prompt:
Build to incorporate any changes, and you’ll instantly see a google drive icon in the sidebar. Apart from installing the extension, you will also need to authenticate your JupyterLab deployment with Google. Go through the setup file or the link here for the process. Once you fill in the credentials, you’ll be able to access your drive from the jupyter lab.
Installation: Through Comand Line Interface
Alternatively, you can install the extension via the CLI, as follows:
#Install the jupyterlab-google-drive extension
jupyter labextension install @jupyterlab/google-drive#Set up your credentials using this guide.# Start JupyterLab
Now, if someone shares a notebook or a markdown file with you, it will reflect in the
shared with me folder in Jupyter Lab. You can open it and edit it in the Jupyter environment seamlessly.
2️⃣. JupyterLab GitHub
JupyterLab Github is a JupyterLab extension for accessing GitHub repositories. With this extension, you can select GitHub organizations, browse their repositories, and open the files in those repositories. If the repositories contain a jupyter notebook, you’ll be able to access them directly in your JupyterLab environment.
Again, you can install this extension either through the extension manager or through the CLI. Please be aware that this package has indicated that it needs a corresponding server extension, which you will be prompted to install before using the extension.
After installation, you need to get the credentials from GitHub.
Once the credentials and permissions are entered, you can access all your repositories in the JupyterLab environment without switching between different interfaces.
3️⃣. Jupyterlab Git
Jupyterlab-git is another useful JupyterLab extension used for version control using git.
To install the extensions, you can follow perform the following steps:
Once installed, the Git extension can be accessed from the Git tab on the left panel
The Jupyterlab-TOC extension populates a table of contents on the left side of a JupyterLab interface. If there is a notebook or a markdown file open, its corresponding TOC will be generated on the sidebar. The entries are scrollable and clickable.
Once the extension is installed, you can modify some of its properties via JupyterLab’s advanced settings editor. For instance, you can collapse sections of notebooks from the ToC by setting the
collapsibleNotebooks parameter as
Drawio plugin is a JupyterLab extension for standalone integration of drawio/ mxgraph into Jupyterlab. draw.io is a free online diagram software for making flowcharts, process diagrams, org charts, UML, ER, and network diagrams.
The Jupyterlab-topbar is an extension for modifying the top bar in the JupyterLab interface. The top bar can be used to place a few useful indicators like:
Once the extension is installed and enabled, you’ll see some indicators on the top bar. There will be a log-out button, dark and light theme switch, custom message, and memory indicators.
7️⃣. Jupyterlab Code Formatter
The Jupyterlab Code Formatter is a small plugin to support various code formatters in JupyterLab. This is one of my favorite extensions since it takes away a lot of pain from code formatting.
The first step is to install the plugin.
The next step would be to install the code formatters. The Jupyterlab Code Formatter currently supports the following formatters in Python and R.
# Install your favourite code formatters from the list abovepip install black isort#orconda install black isort
You can then restart the JupyterLab and configure the plugin, as mentioned here. A quick demo is shown below but for detailed usage, follow the documentation. The code for the following demo has been taken from the Github repository of the extension.
The jupyterlab-chart-editor extension is used for editing the Plotly charts, based on https://github.com/plotly/react-chart-editor. The extension enables editing Plotly charts through a user-friendly point-and-click interface.
The following example has been taken from the official documentation. A figure is first created using plotly and then written to a JSON file. The saved file is then opened using the newly installed plotly editor, and some changes are made to it right on the jupyterLab environment.
In this article, we looked at some useful JupyterLab extensions that make the JupyterLab stand out. Having different tools in a single workplace makes it very useful since one doesn’t have to switch between different environments to get the things done. These add ons will surely make your data analysis process much smoother and more productive.
Originally published here