Template Training

The Build System

Overview

  • Teaching: 15 min
  • Exercises: 0 min

Questions

  • How do I get the build system?
  • What are the dependencies?
  • What are the main components of the build system?
  • How do you make lessons?

Objectives

  • Be able to fork and clone the template repository
  • Understand the structure of lessons
  • Know how to create environment to build lessons
  • Know how to build lessons locally

Clone the template

The template is currently available from arc-bath on Github. While you can fork the repository if you want to contribute to the template tutorial or build system, we recommend that you duplicate the repository to your own account (for each lesson you create. Once you have cloned you can copy (mirror) the repository to create a duplicate where you can develop your tutorial.

Dependencies

Currently the dependencies are a conda installation (Miniconda/Anaconda). We would recommend using an environment to manage the build system as the dependencies may grow over time to accommodate increased functionality/standardisation:

% conda create -n arc-training-bs python=3.6 jupyter

Activate/deactivate the environment with

% source activate arc-training-bs
(arc-training-bs) % source deactivate

Additionally the build system relies upon standard linux commands, e.g. make, sed.

Components

The principle components of the build system are:

  • images
  • notebooks_plain
  • tools

  • images - unsurprisingly contains any images that you wish to use in the lesson either for branding or content.

  • notebooks_plain - contain the contents of the lesson and are edited by the user. N.B. Take care when editing to close notebooks when adding, committing to a repository and particularly (if using them) when you switch between branches. More detail on the different notebook files is given in the next episode.
  • tools - is the home of the python scripts and makefile that constitute the build system. It also has scripts for generating latex and bash magic, as well as setting up the environment on you local machine.

Build

The build works in three stages:

  • make render creates rendered notebooks (from notebooks_plain) in notebooks_rendered
  • make html renders html in html from notebooks-rendered
  • make pdf renders pdfs in pdf from html (Coming soon)

If necessary dependencies and all notebooks are valid .html files these commands are all that is required to build your lesson.

Key Points

  • The build system consists of the tools to build and render the content
  • The repository also contains the content of the lesson
  • The principle depedency is Jupyter and packages that can be maintained in a virtual environment.
  • The system first renders decorated notebooks->html(->pdf).