Directory Structure

Overview:

  • Teaching: 10 min
  • Exercises: 0 min

Questions

  • What are all of the files created with nbfancy init?
  • Where do I put the notebooks that make up my lesson?
  • Where do I put my other files?

Objectives

  • Understand the file structure for a lesson
  • Learn which files go in which directories

Directories

nbfancy uses a directory structure to help organise your lessons. As we have seen, by default the source notebooks for the lesson are contained in the folder, nbplain, rendered notebooks in nbfancy and published pages in html:

In [1]:
!ls example
code  config  data  html  images  nbfancy  nbplain

Additional directories, code, config, data and images are also created.

  • code should be used for source files that are required by your lesson, e.g. bespoke libraries or test files
  • config contains files which control the decoration of your lesson
  • data any data that your students will work with
  • images and pictures or graphics that are not generated automatically

By default only config has any contents.

nbplain

The default template contains three notebooks:

In [2]:
!ls example/nbplain
00_schedule.ipynb  01_untitled_episode.ipynb  99_episode_template.ipynb

These are essentially standard notebooks with decoration determined as described in the next lesson. 00_schedule.ipynb is used to provide a notional schedule for the course, allowing you to specify timings, epsiodes titles and a brief description. The exact format and naming is not a prescription however and could be used as an index.

This is followed by notebooks for each of the episodes that make up your lesson. If you have existing material you can copy the notebooks into the directory add keywords to decorate your lessons, and you should be alomst ready to build. Otherwise this is where you will write all of your notebooks for the lesson.

NOTE The numbering is used to identify the order that you wish notebooks to appear in the rendered form, the next/previous links at the bottom of each rendered page use the list order, what you see with ls, for the navigation.

config

The config folder by default contains two notebooks, a header and footer which contain cells used to brand the lesson. You can edit these notebooks as you would with any other as long as you preserve the number and order of the cells in each.

Additional configurabilty is covered in keywords and template.

In [3]:
!ls example/config
footer.ipynb  header.ipynb

Key Points:

  • nbfancy uses a directory structure to oranise your lessons
  • By default nbplain is used for plain notebooks, nbfancy for decorated notebooks and html for published html.
  • code, data and images are used for dependencies of your lesson
  • config contains files used to modify the decoration of your lessons