Overview#

As TeachBooks, we collect a suite of existing open-source software so you don’t have to! Some of the software is developed with our TA’s to improve the learning experience of our students and ease the book-development process for our teachers. As the open-source software landscape changes rapidly, it is essential to keep in contact and share resources amongst ourselves to minimize maintenance and downtime for our book websites and focus on what really matters: teaching!

Since the list of TeachBook features is getting quite long, we have grouped them in categories:

  • Original Jupyter Book and Sphinx features

  • Easy editing process

  • Additional functionality

  • Book styling

  • TeachBooks student-view features

Additionally, not all features are built and shared in the same way. We do our best to make sure that as many tools as possible are included automatically when using our TeachBooks Template Book; if you are not using the Template, we try to make sure each of our tools can be used independently. For transparency, tags will help differentiate between the different backgrounds of the features:

  • Javascript overlay

  • Chrome Extension

  • GitHub App and Javascript script

  • Python Package: teachbooks

  • GitHub Reusable Action

  • GitHub Template

  • Git Workflow

  • Sphinx Extension

  • iframe

Finally, the purpose, installation process and usage of each features is elaborated on in the respective sub-sections.

To see examples for these features, go to the Examples chapter.

As the TeachBooks Python Package and the Deploy Book Workflow are important tools that incorporate and deploy more than one feature, an additional explanation is provided on this page in more detail, with links to the pages in this manual where individual features are described.

TeachBooks Python Package#

The TeachBooks Python package is a collection of tools that are used to enhance the Jupyter Book software package by adding features and making customization easier. In general, it is only of interest to user types 4 and 5 when building a book locally. However, it may be important for other users to know what the package does, as it is incorporated in the Deploy Book Workflow and, therefore, any book created from the TeachBooks Template. This raises two important points:

  1. If you are a book user using the TeachBooks Template and/or the Deploy Book Workflow, your book is by default built with the teachbooks package, and the way your book is built and features that are included in the book may change automatically when it is updated (these will be non-breaking changes; if not, we will notify our mailing list).

  2. If you are using the jupyter-book package to build your book, some of the features described in this Manual may not be available to you (i.e., those listed on this page). This will be the case if you are using a setup described in the Jupyter Book Manual, for example, this GitHub workflow.

For those who wish to use the package, it is available on PyPI and can be installed using pip install teachbooks. As teachbooks is a wrapper, the package is meant to replace the usage of jupyter-book commands (although it does indeed add a few new commands to the CLI, e.g., serve). It is conventionally used in an identical way, as follows:

teachbooks build book

This Manual describes the main features and usage of the package. For those who wish to understand more of hte technical details, note that the implementation the API is is documented at teachbooks.readthedocs.io/.

List of Features#

Items in the list here are currently implemented in the TeachBooks package and described on other pages of this manual:

The package is also set up to handle APA references when using the Draft-Release Workflow (the _ext subdirectory and its contents are manually copied during the pre-build phase). This will not be necessary once the APA Reference feature is turned into a proper Sphinx extension or Pybtext plugin.

Deploy Book Workflow#

The Deploy Book Workflow is by default incorporated into any book that has been created using the TeachBooks Template. We also strongly encourage anyone to consider this tool as an alternative to the “standard” workflow provided by Jupyter Book, as ours automatically builds a different version of your book for every branch in your respository, along with a number of settings that can be used to customize the build process and URL structure of your book(s). This tool is described in more detail on the Deploy Book Workflow page of this manual, and one should note that it influences a number of other aspects of a TeachBook.

Book Build Commands#

By default the DBW builds books using the following command:

teachbooks build book/

To use the Draft-Release Workflow with the Deploy Book Workflow the BRANCHES_TO_PREPROCESS variable must be configured for a specific branch, which will then execute the following command:

teachbooks build --release book/

Environmnets and Caching#

As described on the DBW page, there is a lot going on “under the hood” with regards to caching of GitHub Action artifacts. This can lead to undesired behavior when using the DBW, especially if package version numbers are not precisely defined. In general we expect the risk of this occurring to be low, as it should only happen when multiple branches are being actively used (new commits on each branch at least once per week), a package from the requirements.txt file is updated in the time between creation of two or more branches, and that package also has a significant impact on the book building process. As the Python virtual environment cache is replaced by default if older than one week, the issue should resolve itself within that time frame.

Note that Specifying package version numbers explicitly and updating them via Dependabot is an excellent way to ensure that environments in the DBW are always up to date and this issue is avoided.

If you are not using Dependabot and are not able to get your packages updated when the DBW is running, delete the cache manually and rerun your GitHub Actions job (go to Actions tab, then looking for the “Caches” section under the “Management” pane on the left hand side of the screen).