The main program for NBfancy is the command line program nbfancy, which we saw in the previous section. Typical usage is nbfancy <verb> [options], where <verb> is some action, and [options] are additional options for that action.
For available actions, we can use the --help flag.
!nbfancy --help
A typical build consists of four steps:
nbfancy initnbfancy rerunnbfancy rendernbfancy htmlTo start making training material we initialise a directory with the nbfancy init [dir] command:
!nbfancy init example
By default init will copy the template lesson to the current working directory, or optional directory argument if provided, to get you started:
.
├── code
├── config
│ ├── footer.ipynb
│ └── header.ipynb
├── data
├── images
└── nbplain
├── 00_schedule.ipynb
├── 01_untitled_episode.ipynb
└── 99_episode_template.ipynb
5 directories, 5 files
For more information about further options for init you can look at the help.
!nbfancy init --help
In order to reduce issues associated with out of order execution, unexecuted cells it is strongly recommended that all notebooks that form a lesson are cleared and re-executed. This can be done quickly and easily with the nbfancy rerun command.
Re-executing all the notebooks in order can be thought of as automated testing for the code in a lesson, ensuring that someone following along in a lesson won't encounter errors.
Note that if you intend to preserve partially executed notebooks/out-of-order execution, you should omit this step.
%%bash2
cd example
nbfancy rerun
Further options for rerun are listed in the help.
!nbfancy rerun --help
Keywords in notebooks can be processed and marked up by running the nbfancy render command. By default this creates a new directory nbfancy containing a rendered versions of the notebooks in nbplain, with cells containing keywords decorated with the respective environments (see environments section).
%%bash2
nbfancy render
As always further options for render are available in the help.
!nbfancy render --help
Once you have checked the contents of the rendered notebooks, the whole lesson can be built into a website by running the nbfancy html command.
%%bash2
nbfancy html
Additional options for html are given by help.
!nbfancy html --help