Introduction to Jupyter Books — Part 1

A guide to publishing your own production quality Technical book

PRANJAL BIYANI
The Startup
4 min readSep 14, 2020

--

https://jupyter.org/

Project Jupyter has been a boon for the Data Science, Machine Learning, and AI Community of Practitioners and Developers.

Every time I start building a Report or a Model, the first tool that comes to my mind is

“The Legendary Jupyter Notebook”

I’ve also worked with Jupyter Lab, an easily accessible collection of Jupyter Notebooks and other files. In February 2019, Project Jupyter further launched Jupyter Books — a complete package with amazing capabilities.

Before getting started, I would like to mention the fact that building the best Jupyter Books would require some basic HTML understanding, in fact as long as you can use basic logic and figure out a way to edit stuff inside your HTML files, you’re good to go. Let’s hit it!

Jupyter Books : https://jupyterbook.org/intro.html

First, what can you do with Jupyter Books?

  1. Publish Technical Content in Jupyter Notebooks including rich syntaxes such as citations, cross-references, and numbered equations
  2. Quality Documentation with MathJax, Markedly Structured Text (MyST), and PDF’s
  3. Interactive Outputs and links to Project repositories and Issues on Github
  4. Customized Rendering for Notebooks, Images, and Figures with Sphinx

Most importantly, you are now capable of publishing your own production quality Technical Data Science Book Online, with Code, Images and Documents.

Let’s get started with Jupyter Books

Since, Jupyter books are comparatively new and still in a rapid development phase, to keep your other installations and dependencies safe, it’s recommended to first set up your Virtual Environment

Virtual Environment

Installation

Create your first Jupyter Book : Source files for the Book

Create Confirmation

Build your Jupyter Book : Runs the Book over source files

Build Confirmation

and just like that, you’ve built a Jupyter Book. Let’s make it yours now.

What Now?

If you followed along, this is what you should get when you open the MyFirstJupyterBook/_build/html/index.html file in your browser

Personalize !

  1. Change the Image of the book
  2. The Description
  3. Add Github Repository Link
  4. Add a Jupyter Notebook

The 2 important files to personalize a JupyterBook —

  • _config.yml: To manage the Book Design Settings
  • _toc.yml: To define the Table of Contents

Let’s look at each one of them individually

_config.yml

_config.yml

Customizable options —

  • title: The Title of the Book
  • author: Yours Truly
  • logo: You!
  • Github URL

We start with copying an image from our Local desktop to the Jupyter Book Directory with the following command :

Open the file with vim editor, hit ‘i’ Insert, Edit & Save with “Esc”+ “:wq”

Editing the _config.yml file

After editing the _config.yml file, go back to the parent folder and build the Book again to implement the changes made, TA-DA !!

Further, edit the “intro.md” file to change the Introduction Statements to your Book.

Finally, let’s add a Jupyter Notebook to our Book

Build a simple Jupyter Notebook using Anaconda and add a few markdown cells and Code Cells to make sure there is some content in the notebook

Copy the Jupyter Notebook from your current directory to your Jupyter Book

Add this Jupyter Notebook to your Table of Contents in the _toc.yml file and edit as follows -

Build your Jupyter Book one last time and the magic happens!

In the Content in Jupyter Notebook Section, you will find the first Markdown of your Notebook as a file and BINGO!

Congratulations! on building your first Jupyter Book and I hope you enjoyed the process with minimum complications. To be honest, we just scratched the surface and there’s a lot more to be achieved with this super Tool. Part — 2 Coming Soon…

Have a great day! Cheers!

--

--

PRANJAL BIYANI
The Startup

Create or Find problems 1st ; Solve or Fix problems 2nd. Learn on the way.