Build your book: JupyterBook

Build your book: JupyterBook#

User types

This page is useful for user type 5.

Jupyter book is a regular Python package which converts our content into a website. It’s part of all of the requirements.txt files for a book repository. At TeachBooks we developed a Python package called teachbooks which takes over the these features and adds additional features. One of those additional features, for example, is the workflow to GitHub Pages.

Concretely, this means that the teachbooks package can be used to replace the Jupyter book package when calling these features. You could think of it as jupyter-book being a dependency of teachbooks.

Note

Don’t forget to add the package teachbooks in the requirements.txt files in your book repository and to have it installed in your working environment (pip install teachbooks).

Build a book#

As soon as you’ve installed your book environment with jupyter-book you can build your book locally. The official Jupyter book documentation is quite extensive. You can navigate to the directory where your book is to leave out the path-to-book.

teachbooks build <path-to-book>

Alternatively:

jupyter-book build <path-to-book> --all

Note: use --all for the jupyter-book whenever building a book to make sure the table of contents fully updates. Or alternatively, delete the old _build folder before building the new book.

View the book locally#

Once the build process is completed successfully, you will see the file location in your terminal output. Your terminal will look something like this. Simply open this in the browser (you may have to copy/paste).

../_images/Terminal.PNG

Fig. 3 Terminal#