Productivity Tips for Jupyter Notebook
Here are some tips to make you more productive with
.ipynb files (i.e. Jupyter notebooks).
First, don’t ever directly use Jupyter notebooks!
Instead, you should either use VSCode or Jupyter Lab to work with
As you can see below, Jupyter notebooks are extremely sparse and don’t provide any of the benefits of an IDE.
Your best option is to use VSCode to run and write
This allows you to benefit from the full power of VSCode, including keyboard shortcuts, extensions (e.g. Github Copilot), a file browser, an embedded terminal, debugger, etc.
Open up VSCode and install the following extensions:
- Jupyter Keymap
- Jupyter Slide Show
- Jupyter Cell Tags
- Jupyter Notebook Renderers
Simply open up the
.ipynb file in VSCode
Here’s what an
.ipynb notebook loaded in VSCode looks like:
Note: You may need to explicitly tell VSCode what Jupyter Kernel to use for running your
.ipynb file. You can do so by clicking the “Select Kernel” button in the top right of the screen. In the image above, I’ve selected
base as my environment.
Use Jupyter Lab
If you can’t use VSCode, the second best option is to use Jupyter Lab, which was developed by the creators of Jupyter.
pip install jupyterlab
Here’s what an
.ipynb notebook loaded in Jupyter Lab looks like:
Add these snippets as cells to the top of your
This snippet tells Jupyter to automatically reload imported modules whenever their contents change.
%load_ext autoreload %autoreload 2
For example, lets say you are actively editing a file called
utils.py that you import into your notebook with
import utils. Whenever you save changes to
utils.py, you’ll have to rerun
import utils, which can be annoying if you’re doing frequent edits. With this snippet, Jupyter will intelligently re-import
utils whenever you edit