source/{assignment_id}/{notebook_id}.ipynb
The student_id
is not included in the notebook directory structure, because the master source version of the assignment is used for all students and master release version for all students.
After running nbgrader assign
, the release version of the notebooks will be:
release/{assignment_id}/{notebook_id}.ipynb
As a reminder, the instructor is responsible for distributing this release version to their students using their institution's existing student communication and document distribution infrastructure.
This example walks an instructor through the workflow for generating an assignment and preparing it for release to students:
Setting up the database is the first workflow step to create a release version of an assignment.
A connection to the database is set by passing Gradebook
the default database url, sqlite:///gradebook.db
which links to the sqlite database gradebook.db
located in the current directory.
Next, the assignment is added to the database and the assignment's due date is set using add_assignment
:
In [ ]:
import os
# remove an existing database
if os.path.exists("gradebook.db"):
os.remove("gradebook.db")
# create a connection to the db using the nbgrader API
from nbgrader.api import Gradebook
gb = Gradebook("sqlite:///gradebook.db")
# add the assignment to the database and specify a due date
gb.add_assignment("Problem Set 1", duedate="2015-02-01 15:00:00.000000 PST")
Now that the gradebook is set up, run nbgrader assign
. When running nbgrader assign
, the assignment name (which is "Problem Set 1") is passed. We also specify a header notebook (source/header.ipynb
) to preprend at the beginning of each notebook in the assignment:
In [ ]:
%%bash
nbgrader assign "Problem Set 1" --IncludeHeaderFooter.header=source/header.ipynb