Do You know the feeling of being already late to a party when encountering something new?
But when you actually start telling others about it, you realize that it is not too common knowledge at all, e.g. Jupyter Notebooks.
What is a Jupyter notebook?
In my own words: a browser-based document-oriented command line style exploration tool for Julia, Python and R, hence the name JuPyteR Huh!
Ok, let’s break it down:
JuPyter is a client-server concept where you edit your code in a web form in a browser. You send the input of a cell to the server backend for execution and the server sends back a response which will be rendered in your browser.
On great aspect of a JuPyter is that You can enrich your code in a nice fashion with headlines and markdown code so that you have a document containing code, the result of the code execution and documentation.
Installation and Run
If You already have a python installation You can either use pip or pipenv to install JuPyter
pip install jupyter
pipenv install jupyter
After installation you can start it on the console with:
An alternative way is to use the anaconda distribution.
On big drawback -when your background is SW development- is that You don’t have code completion.
Another disadvantage: modularization of your code is not easy.
Versioning is an issue as well. Because the Jupyter notebook’s json files contains code and generated artifacts like plots every re-run of a notebook changes the file. The diff is not easily comprehensible.
For the code completion issue there is JetBrains for the rescue: PyCharm IDE has an integrated JuPyter editor which supports code completion.
Useful Keyboard Shortcuts
You can open command palette via
Cmd + Shift + P on Mac OS or via
Ctrl + Shift + P on Linux and Windows
Ctrl + Enter Run Cell
Alt + Enter Run Cell and insert new cell below