{course_directory}/source/{assignment_id}/{notebook_id}.ipynb
Note: The student_id
is not included here because the source and release versions of the assignment are the same for all students.
After running nbgrader assign
, the release version of the notebooks will be:
{course_directory}/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
. If this database does not already exist, nbgrader will automatically create it. By default, the nbgrader commands (like nbgrader assign
) will assume that this database is called gradebook.db
and that it lives in the root of your course directory, though its name and path can be configured in nbgrader_config.py
.
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. By default, this command should be run from the root of the course directory:
In [ ]:
%%bash
nbgrader assign "Problem Set 1" --IncludeHeaderFooter.header=source/header.ipynb