Fetching assignments

.. seealso:: :doc:`/command_line_tools/nbgrader-fetch` Command line options for ``nbgrader fetch`` :doc:`/command_line_tools/nbgrader-list` Command line options for ``nbgrader list`` :doc:`/config_options` Details on ``nbgrader_config.py``

From the student's perspective, they can list what assignments have been released, and then fetch a copy of the assignment to work on. First, we'll create a temporary directory to represent the student's home directory:

In [ ]:

# remove the fake student home directory if it exists, for demo purposes
rm -rf /tmp/student_home

# create the fake student home directory and switch to it
mkdir /tmp/student_home

If you are not using the default exchange directory (as is the case here), you will additionally need to provide your students with a configuration file that sets the appropriate directory for them:

In [ ]:
%%file /tmp/student_home/nbgrader_config.py

c = get_config()
c.TransferApp.exchange_directory = '/tmp/exchange'
c.NbGrader.course_id = "example_course"

From the command line

From the student's perspective, they can see what assignments have been released using nbgrader list, and passing the name of the class:

In [ ]:
export HOME=/tmp/student_home && cd $HOME

nbgrader list

They can then fetch an assignment for that class using nbgrader fetch and passing the name of the class and the name of the assignment:

In [ ]:
export HOME=/tmp/student_home && cd $HOME

nbgrader fetch "Problem Set 1"

Note that running nbgrader fetch copies the assignment files from the exchange directory to the local directory, and therefore can be used from any directory:

In [ ]:

ls -l "/tmp/student_home/Problem Set 1"

Additionally, the nbgrader fetch (as well as nbgrader submit) command also does not rely on having access to the nbgrader database -- the database is only used by instructors.

From the notebook dashboard

Alternatively, students can fetch assignments using the assignment list notebook server extension. You must have installed the extension by following the instructions `here `__, after which you should see an "Assignments" tab in dashboard:

The image above shows that there has been one assignment released ("ps0") for the class "cogsci131". To get this assignment, students can click the "Fetch" button (analagous to running nbgrader fetch ps0 --course cogsci131. Note: this assumes nbgrader is always run from the root of the notebook server, which on JupyterHub is most likely the root of the user's home directory.

After the assignment is fetched, it will appear in the list of "Downloaded assignments":

Students can click on the name of the assignment to expand it and see all the notebooks in the assignment:

Clicking on a particular notebook will open it in a new tab in the browser.