What made me decided to give Jupyter Notebook A Second Chance

06 Oct 2019

Why I am giving Jupyter Notebook a second chance?

When I first learned python, I used jupyter notebook (or ipython notebook back then). But I dropped it in a month. Here are the top three reasons.

#1: It wasn’t enhancing my efficiency

First, I prefer to write my codes in scripts so I can reuse them in other scripts. I always have a terminal running python that allows me to quickly test my code. So I didn’t feel like I was gaining much with jupyter notebook. In addition, I like writing automated codes to make plots in pre-defined directories, with informative filenames for each figure, especially becuase I run a lot of my codes on a supercomputer or a remote server. I prefer to inspect and compare all my plots sequentially/side-by-side and have a hard copy than having to open a Jupyter notebook to compare results.

#2: Jupyter notebook metadata screw up version control

Second, I use version control for my codes, but the metadata stored in Jupyter notebook messed that up, leading github to think that I changed everything even if I just saving my .ipynb regularly.

#3: Sharing codes with collaborators

While a lot of the code demo are written in python notebook and I appreciate certain features it offers to quickly show someone some snippets of codes and outputs; however, it’s not the right tool to collaborate with others, nor doing code reviews.

(Perhaps there are ways that I am not aware of which I would greatly appreciate if you can leave a comment below.)

Jupytext to the rescue

At the research insitute, we hold regular meetings to share tools and ways to better our programming skills. I came across this new tool called Jupytext, which is easy to install and use. It synchronizes a .ipynb with a .py file! This means that if I write any codes in .ipynb, I can still upload an up-to-date .py file to my Github repository. Similarly, if any changes is made to a .py file (by me or a collaborator), I can just open the .ipynb file and run it.

With this I am giving jupyter notebook a second chance. Given my existing workflow, I still prefer to write codes in scripts and excecute them in batch. But for running machine learning methods, I find jupyter notebook to be useful thus far.

More references on Jupytext:

comments powered by Disqus