<commit_before>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Assign and release an assignment"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    ".. seealso::\n",
    "\n",
    "    :doc:`/command_line_tools/nbgrader-assign`\n",
    "        Command line options for ``nbgrader assign``\n",
    "        \n",
    "    :doc:`01a_filestructure`\n",
    "        Details about how the directory hierarchy is structured\n",
    "\n",
    "    :doc:`/config_options`\n",
    "        Details on ``nbgrader_config.py``"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "After an assignment has been created with the assignment toolbar, you will want to create a release version of the assignment for the students.\n",
    "\n",
    "As described in :doc:`01a_filestructure`, you need to organize your files in a particular way. For releasing assignments, you should have the master copy of your files saved (by default) in the following source directory structure:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "{course_directory}/source/{assignment_id}/{notebook_id}.ipynb\n",
    "```\n",
    "\n",
    "Note: The `student_id` is not included here because the source and release versions of the assignment are the same for all students.\n",
    "\n",
    "After running `nbgrader assign`, the release version of the notebooks will be:\n",
    "\n",
    "```\n",
    "{course_directory}/release/{assignment_id}/{notebook_id}.ipynb\n",
    "```\n",
    "\n",
    "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."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Workflow example: Instructor generating an assignment release"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This example walks an instructor through the workflow for generating an assignment and preparing it for release to students:\n",
    "\n",
    "1.  Add problem set to the source folder\n",
    "2.  Set up connection to the database and add the assignment\n",
    "3.  Assign a problem set using nbgrader\n",
    "4.  Inspect the release folder"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1. Add problem set to the source folder\n",
    "\n",
    "To simplify this example, two notebooks of the assignment have already been stored in the `source/Problem Set 1` folder:\n",
    "\n",
    "* [source/Problem Set 1/Problem 1.ipynb](source/Problem Set 1/Problem 1.ipynb)\n",
    "* [source/Problem Set 1/Problem 2.ipynb](source/Problem Set 1/Problem 2.ipynb)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. Configure assignments in the config file\n",
    "\n",
    "Creating a `nbgrader_config.py` file and configuring the list of your assignments is the first workflow step to create a release version of an assignment. These assignments will be automatically added 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`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "%%file nbgrader_config.py\n",
    "\n",
    "c = get_config()\n",
    "c.NbGrader.db_assignments = [dict(name=\"Problem Set 1\")]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.  Assign a problem set using nbgrader\n",
    "\n",
    "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:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "\n",
    "nbgrader assign \"Problem Set 1\" --IncludeHeaderFooter.header=source/header.ipynb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4.  Inspect the release folder\n",
    "Upon completion of `nbgrader assign` in the previous step, there will be a new folder called `release` with the same structure as `source`. The `release` folder contains the actual release version of the assignment files:\n",
    "\n",
    "* [release/Problem Set 1/Problem 1.ipynb](release/Problem Set 1/Problem 1.ipynb)\n",
    "* [release/Problem Set 1/Problem 2.ipynb](release/Problem Set 1/Problem 2.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 0
}<commit_msg>Remove extra nb cell<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Assign and release an assignment"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    ".. seealso::\n",
    "\n",
    "    :doc:`/command_line_tools/nbgrader-assign`\n",
    "        Command line options for ``nbgrader assign``\n",
    "        \n",
    "    :doc:`01a_filestructure`\n",
    "        Details about how the directory hierarchy is structured\n",
    "\n",
    "    :doc:`/config_options`\n",
    "        Details on ``nbgrader_config.py``"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "After an assignment has been created with the assignment toolbar, you will want to create a release version of the assignment for the students.\n",
    "\n",
    "As described in :doc:`01a_filestructure`, you need to organize your files in a particular way. For releasing assignments, you should have the master copy of your files saved (by default) in the following source directory structure:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "{course_directory}/source/{assignment_id}/{notebook_id}.ipynb\n",
    "```\n",
    "\n",
    "Note: The `student_id` is not included here because the source and release versions of the assignment are the same for all students.\n",
    "\n",
    "After running `nbgrader assign`, the release version of the notebooks will be:\n",
    "\n",
    "```\n",
    "{course_directory}/release/{assignment_id}/{notebook_id}.ipynb\n",
    "```\n",
    "\n",
    "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."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Workflow example: Instructor generating an assignment release"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This example walks an instructor through the workflow for generating an assignment and preparing it for release to students:\n",
    "\n",
    "1.  Add problem set to the source folder\n",
    "2.  Set up connection to the database and add the assignment\n",
    "3.  Assign a problem set using nbgrader\n",
    "4.  Inspect the release folder"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1. Add problem set to the source folder\n",
    "\n",
    "To simplify this example, two notebooks of the assignment have already been stored in the `source/Problem Set 1` folder:\n",
    "\n",
    "* [source/Problem Set 1/Problem 1.ipynb](source/Problem Set 1/Problem 1.ipynb)\n",
    "* [source/Problem Set 1/Problem 2.ipynb](source/Problem Set 1/Problem 2.ipynb)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. Configure assignments in the config file\n",
    "\n",
    "Creating a `nbgrader_config.py` file and configuring the list of your assignments is the first workflow step to create a release version of an assignment. These assignments will be automatically added 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`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "%%file nbgrader_config.py\n",
    "\n",
    "c = get_config()\n",
    "c.NbGrader.db_assignments = [dict(name=\"Problem Set 1\")]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.  Assign a problem set using nbgrader\n",
    "\n",
    "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:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "%%bash\n",
    "\n",
    "nbgrader assign \"Problem Set 1\" --IncludeHeaderFooter.header=source/header.ipynb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4.  Inspect the release folder\n",
    "Upon completion of `nbgrader assign` in the previous step, there will be a new folder called `release` with the same structure as `source`. The `release` folder contains the actual release version of the assignment files:\n",
    "\n",
    "* [release/Problem Set 1/Problem 1.ipynb](release/Problem Set 1/Problem 1.ipynb)\n",
    "* [release/Problem Set 1/Problem 2.ipynb](release/Problem Set 1/Problem 2.ipynb)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
{'fraction_non_alphanumeric': 0.14752754758218742, 'fraction_numerical': 0.0068299790547308985, 'mean_word_length': 3.093179276928811, 'pattern_counts': {'":': 116, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5040341', 'n_tokens_mistral': 3610, 'n_tokens_neox': 3457, 'n_words': 1150}