5 Jupyter Lab Hacks for a Better Life

Meirav Ben Izhak
3 min readAug 31, 2020

--

4 Hacks to brighten up your jupyter lab experience +1 to darken it (in a good way)

1. When You Work With Several Notebooks You Can Customize Their Locations by Dragging

How often do you open 2 (or more) notebooks to copy code from one to the other? I do quite often and learned that by dragging my notebooks I can place them near each other like different windows instead of the default several-tabs display. You can place your notebooks side by side or one below the other or — and this is insane — both.

Example of three notebooks placed near each other as separate windows

2. Use %Who to See What Variables You Have in Your Environment

If you’ve been working on the same notebook for a while, you might have forgotten what variables you have in the environment. One way to check is to use the magic line function ‘who’ as shown in the picture.

Example of using %who

3. Save an Entire Environment With Dill

Need to shut down your kernel for some reason and don’t want to lose your environment? Don’t lose your chill — simply use dill.

Two useful things dill does are -

  1. Dump session— saves all existing variables of an environment into a file.
  2. Load session— loads all variables from the file into the environment.

How to run this operation -

  • Install
pip install dill
  • Use
import dill#to dump:
dill.dump_session(‘session.db’)
#to load:
dill.load_session(‘session.db’)

4. Open a Function’s Documentation With Shift-Tab

Using a function and can’t fully recall its parameters? press shift-tab (not before placing your cursor inside the brackets) and the function’s
documentation will appear.

Example of using shift-tab

5. Dark Mode

If you’re on the dark-mode team and didn’t know this yet then I’m happy to announce that Jupyter Lab has a dark theme, I personally encountered it by coincidence and boy was I happy. how to apply-

on the menu (left) choose the palette -> Theme -> Use JupyterLab Dark Theme

Notebooks in Dark and White Mode

Thanks for reading, I hope you found these useful. If you have other hacks you’re willing to share please do in the comments. Cheers!

--

--

Meirav Ben Izhak

Data science enthusiast, Bioinformatics MSc graduate, former podcaster.