Neovim PDE for Data Science

Configure a PDE for data science programming.

alpha2phi

--

Neovim PDE for Data Science

In this article, we will explore configuring an opinionated development environment for exploratory data analysis and machine learning.

This article is part of the Neovim PDE series.

The Neovim configuration files are available in this repository.

Getting Started

In a previous article, we mentioned different approaches to using Neovim with Jupyter. Specifically, we went through the following.

  • We used Jupyter Ascending to edit Jupyter Notebook from Neovim, which instantly syncs and executes the code in the Jupyter Notebook running in the browser.
  • We used Firenvim to turn the browser into a Neovim client and use it with Jupyter.
  • We talked about Magma-nvim, Sniprun and other plugins that can be used to interact with the REPL.

This article will configure an opinionated approach to using Neovim with Jupyter Notebook.

  • We want to use Neovim for development.
  • We still want to have the Jupyter Notebook, and the ability to sync the code with the notebook.
  • We want to have a similar experience using a Jupyter Notebook within Neovim.

Neovim with Jupyter

The environment is configured in the lua/pde/jupyter.lua file. The full source code is listed at the end of this article.

With the environment configured, we can use it to edit a Jupyter Notebook or Python file.

Jupyter Notebook in Python

When we open a notebook (.ipynb), the code is converted into a Python file, and each cell is separated by the marker # %%.

Jupyter Notebook

This environment also works for a typical Python file. We can split the code into different sections using the cell marker and run them.

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.