Trying to read a .ipynb file without starting a jupyter server? jut has you covered.
watch the video version of this post on YouTube
is packaged and available on pypi so installing is as easy as pip installing it.
pip install jut
! This is my first time including snippets of the video in the article like this, let me know what you think!
jut https://cantera.org/examples/jupyter/thermo/flame_temperature.ipynb jut https://cantera.org/examples/jupyter/thermo/flame_temperature.ipynb --head 3 jut https://cantera.org/examples/jupyter/thermo/flame_temperature.ipynb --tail 2
what are all the commands available for jut?
Take a look at the help of the
cli to explore all the options that it
There is some good information on the projects readme as well.
Don't want jut cluttering up your venv, or want to save yourself from making a
can manage a separate virual
environment for you. This is one of the biggest selling points for me.
pipx run jut https://cantera.org/examples/jupyter/thermo/flame_temperature.ipynb --head 3
is the lightweight option that I think will fit the bill often for me,
but it just doesn't always cut it. Mostly if there are images in the notebook
or large output that is hard to read, its time to pull out the medium guns
that sit between fulling running jupyter and
pip install nbconvert
nbconvert does not have its own cli, instead it sits under the jupyter command.
converting to html
Need to see images, go here!
wget https://cantera.org/examples/jupyter/thermo/flame_temperature.ipynb jupyter nbconvert flame_temperature.ipynb --to html python -m http.server
Note, nb convert does not work with a url, you will need to have the notebook locally.
what other options does nbconvert offer?
also offers a standard help flag that you can access by passing in
jupyter nbconvert --help
converting to markdown
also supports converting to many other formats, one option that is
quite interesting for use in the terminal is markdown. We could simply convert
the notebook to markdown and cat it out.
jupyter nbconvert flame_temperature.ipynb --to maarkdown cat flameflame_temperature.md
viewing markdown with glow
Glow is a terminal markdown viewer that looks really good. These days I use
so I don't get quite as much benefit from
, but it still
looks pretty good.
viewing markdown as slides with lookatme
Lookatme is my slideshow tool of choice. Creating slides in markdown is such a fantasic user experience, It realy lets you go from outline to finished slide deck fluidly. Refactoring the whole thing is also so much easier than with gui tools. Once you have your idea fleshed out it does make the process of making slides in powerpoint much easier if thats what you need.
On to nbconvert, without even changing the notebook we can look at the notebook as a slideshow in the terminal. The only thing that it needs is some markdown headers to start new slides from.
viewing markdown with rich
Bringing this full circle, lets take a look at the converted markdown with
rich. Here you will notice a surprising similarity to what we saw with
pip install rich python -m rich.markdown flame_temperature.md
Rich still cannot pull directly from a url or display markdown with out being
installed and managed by yourself. Unlike how
manage the installation sandbox for you.
- jut - View notebooks in the terminal
- nbconvert - convert notebooks to other formats
- flame-temperature notebook - The sample notebook I used
- glow - Terminal Markdown viewer
- lookatme - Terminal Markdown slideshow tool
- pipx - Run python cli's without maintianing a virtual environment
- rich - Beautiful python terminal formatter