· jupyterlab til

JupyterLab 4.0.5: Adding execution time to cell

I’ve been using Jupyter Lab notebooks in some of my recent videos on Learn Data with Mark and I wanted to show cell execution timings so that viewers would have an idea of how long things were taking. I thought I’d need to use a custom timer, but it turns out there’s quite a nice plug-in, which we’ll learn about in this blog post.

The plug-in is called jupyterlab-execute-time and it shows a live view of the time that a cell takes to execute, as well as showing the execution time afterward.

cell execution time
Figure 1. The jupyterlab-execute-time plugin-in in action

We can install the library directly using pip:

pip install jupyterlab_execute_time

Or Poetry, if that’s your thing:

poetry add jupyterlab_execute_time

Alternatively, we can use the extension manager inside Jupyter Lab, which you can launch by typing Cmd + Shift + X on a Mac. Once it pops up, search for jupyterlab-execute-time, as shown below:

time extension manual search
Figure 2. Searching for the jupyterlab-execute-time plug-in

And then click on 'Install'.

Regardless of the installation option used, you should then see the plugin under the 'Installed' section:

time extension installed
Figure 3. jupyterlab-execute-time plug-in installed

And here’s a screenshot showing the timings for a few cells in a notebook that I’m currently working on:

jupyterlab time execution cell
Figure 4. Multiple cell timings
  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket