Jupyter lab struggles to compete with fully fledged IDEs, but it’s a better development environment than what some people think. It has features which aren’t exactly hidden, but seemingly aren’t often written about and can take a while to discover independently, so I thought I’d share some small but very useful discoveries!

If you’re a total Jupyter Lab beginner, others have already written about other features, in detail. It’s definitely worth learning the keyboard shortcuts - this article mentiones a few

It’s worth mentioning that, at the time of writing (September 2020) the latest version is v2.2.8, with v3 seemingly right around the corner. Jupyter lab is the type of software that you can install and forget about until it becomes a problem, so it’s worth checking what you’re running by clicking Help > About JupyterLab

Contextual help

Jupyter lab simply isn’t as responsive as a more traditional IDE, but you can show a function signature and documentation by pressing shift+tab when your cursor is inside the parenthesis for a function call (like math.sin(|2.)). Otherwise, pressing ctrl+i opens a Contextual Help tab. Drag that to the side to create a new window, then click on any function to see the same signature/documentation help

Bear in mind that this only works if you have a running kernel - Python is a dynamic language and jupyter is an especially dynamic/potentially out-of-order environment, so runtime type information is always richer. Consider the following example, in which the type of x depends on which of the preceding cells was run. Without a running kernel, jupyter can’t do all that much

This can actually mean that there is more type information available to the auto-completer, in situations where type inference of untyped code struggles

Saving pictures and videos

If you have an image/video inside jupyter lab that you want to send to someone, you’ll find that right clicking on it doesn’t work. However, at the bottom of the menu that does pop up, there’s a light gray instruction telling you how to get your regular right-click behaviour. For me on firefox, that’s shift + right click. Now you should be able to copy images to your clipboard (and paste them in chat applications), or save the video to your laptop

Auto-reloading code

I’ve written about this already so I won’t repeat myself in detail here - in short, you can write code in a .py file, import it in a notebook, update the .py file, and have the updated code stay in sync with the imported module instance. It’s incredibly useful if you’re developing a library in regular Python files, and testing it using jupyter notebooks

Extensions

Jupyter lab is actually built around extensions, some of which are very useful.

Enable the extension manager by following the instructions in the jupyterlab extension docs. Test it out by clicking the puzzle piece in the left panel, searching for jupyterlab-execute-time, and then following the instructions to install it. Some extensions are not so simple to install, though, especially when virtual environments are involved

The execute-time extension is incredibly useful, simply because it’s always on. I find I appreciate it more when doing long-running variable length work. It also separates the timing output from the rest of your printing. You should still use the %%timeit cell magic for functions which need to be run multiple times, though

Better ways to diff notebooks

.ipynb files produce very noisy git diffs, especially for files which haven’t had their output stripped before being committed (although that can be set up to automatically run on every git commit). However, keeping the output of a notebook clearly shows what works/what doesn’t at the it was committed, and is nicer for others who want to look at the notebook outputs without actually running it

Luckily there are free and paid (but still free for open source) tools which help spot the differences between notebooks. I’ll leave you to decide which makes sense for you, but many people I know simply aren’t aware that tools like that exist!

Below is an an example taken from reviewnb:

Other notebook IDEs

Finally, if you still don’t like Jupyter Lab, there are other IDEs which offer a similar experience but prioritize different things. I don’t currently use them so I can’t really speak for their “main features”, but I’ll link to a few of them here in case one of them seems right for you:

In closing

Please let me know if you know of any other useful jupyter lab features - the tips above have all helped me greatly, but took a while to discover