updated: 4th of October 2019
published: 28th of January 2019
Jupyter Lab is the next-generation web-based user interface for Jupyter project. I first encountered The Jupyter project back when it was know as IPython notebooks and used it for hacking on python projects.
I was pleasantly surprised to learn that the Jupyter project also supports kernels other than Python with Ruby being one of them. This post covers installing the iRuby kernel for use with Jupyter Notebooks.
This post assumes that rbenv and ruby 2.6.0 is already installed. You can follow post post to get them installed.
For reference the following software will be used in this post.
Install the required dependencies.
sudo apt install libzmq3-dev libczmq-dev
Create a virtual environment and Install Jupyter Lab.
mkdir -p /home/bradmin/Documents/code/python/jupyter-lab
cd /home/bradmin/Documents/code/python/jupyter-lab
source .venv/bin/activate
pip install jupyterlab
Create a ruby environment and install iRuby and its dependencies.
mkdir -p /home/bradmin/Documents/code/python/jupyter-lab/ruby
cd /home/bradmin/Documents/code/python/jupyter-lab/ruby
rbenv local 2.6.0
gem install bundler cztop iruby
Now register the Ruby kernel with Jupyter Lab.
iruby register --force
Start Jupyter lab.
jupyter-lab
Your browser will open, select the Ruby Kernel notebook.
Ruby does not have a nice interactive terminal, it has IRB which is very bare bones and does not have a great user experience. Using Jupyter Lab with a Ruby kernel is a nice way to hack on a Ruby project with a user friendly interface.
Update: Ruby does have pry which is very nice alternative to IRB.
https://jupyterlab.readthedocs.io/en/stable/
https://github.com/jupyter/jupyter/wiki/Jupyter-kernels