Dimitris Poulopoulos

Machine Learning Engineer | Researcher

Jupyter has a perfect code editor

18 February 2021

Notebooks have always been a tool for the incremental development of software ideas. Data scientists use Jupyter to journal their work, explore and experiment with novel algorithms, quickly sketch new approaches and immediately observe the outcomes.

Moreover, JupyterLab is moving towards becoming a full-fledged IDE; just not an IDE you are used to. With its great extensions and libraries like kale and nbdev, it is certainly capable of doing much more than just drafting an idea.

However, once every blue moon, we may want to edit a .py file. This file may hold some utility functions we import in the Notebook or define our models’ classes. It’s a good practice to work like that, so we don’t pollute the Notebooks with many definitions. But the text editor bundled with JupyterLab is just that: a simple, featureless text editor.

So, what can we do? There are efforts like this one, which tries to integrate the monaco editor (the code editor which powers VS Code) into JupyterLab. Still, as the contributors explicitly mention in the README file, “this extension is merely a ‘proof-of-concept’ implementation and nowhere near production status.” Also, the last commit was 3 years ago (at the time of writing), so it doesn’t seem like a very active project.

But we do not need any extension. We have a terminal. Thus, we can have ViM. And ViM has everything we need; it just takes some time to master. If you love ViM, you know what I’m talking about. If you don’t, don’t shy away yet! This story shows you how to turn ViM into a Python IDE and use it side-by-side with Jupyter.

Continue reading ->