Jupyter notebook assignment formatting and distribution for Otter-Grader
Project description
otter-assign: Jupyter Notebook Assignments with Otter-Grader
Format and tools for authoring and distributing Jupyter notebook assignments with autograding using Otter-Grader.
Requires: Python 3 (even if it's installed, check that it's your working version python --version
)
Getting started
Course instructors author assignments as Jupyter notebooks by creating a notebook that contains setup code, questions, solutions, and tests to validate those solutions. This project prepares an assignment to be distributed to students and later scored automatically.
The notebook format is not specific to a programming language or autograding framework, but was designed to be used with Otter, which is Python based. Contributions to support other testing frameworks, such as nbgrader and other programming languages, are welcome.
An example notebook appears in test/example.ipynb
, which uses the notebook
format. To convert it, run:
oassign test/example.ipynb test/output
test/example.ipynb
: an example notebook path that you'll need to replace with the path to the master solution notebook, which was augmented with the metadata and commands from the notebook format.test/output
: the path to where the output will be stored- the output contains two directories
autograder
andstudent
- the
autograder
directory contains the full set of tests and a solution notebook (a solution notebook is different from the master notebook, because it is not formatted accordidng to the notebook format but instead looks like the student notebook with solutions) - the
student
directory contains an automatically created redacted version.
- the output contains two directories
- at the end of the command, specify paths to any support files (e.g. data files) needed by the notebooks to be copied into the
autograder
andstudent
directories
Before you run the oassign
command, make sure that you run the entire notebook top to bottom (Cell -> Run All
) to make sure that every cell has the correct output -- the output of the cells will be turned into the appropriate tests stored in the provided output directory (second argument of the oassign
command). If you change the tests, you need to re-generate the files by re-running the notebook and the oassign
command.
Caution
Test outside of a question
File "/opt/conda/lib/python3.6/site-packages/oassign/to_ok.py", line 141, in gen_ok_cells
assert not is_test_cell(cell), 'Test outside of a question: ' + str(cell)
AssertionError: Test outside of a question:
If you get this error, this means that you have more than one cell between the markdown cell that declared the question (i.e., the one that contains #BEGIN QUESTION
) and the cell that contains the # TEST
.
SOLUTION: remove the extra code/markdown cell(s) either between the solution cell and the markdown cell with the #BEGIN QUESTION
or between the solution cell and the # TEST
cell.
Test cell with a blank on the last line
If your test contains a blank/newline after the test, otter-assign seems to automatically add a semicolon at the end of the test, thus, supressing the output of the command.
Example:
# TEST
movies.head(1)['plots'][0]=='Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.'
Turns into the following failed test in the students' notebook:
>>> movies.head(1)['plots'][0]=='Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.';
>>>
# Error: expected
# True
# but got
SOLUTION: remove the blank line at the end of the # TEST
cell.
Changelog
v0.0.2:
- Added custom prompts for manually graded questions
v0.0.1: Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file otter-assign-0.0.2.tar.gz
.
File metadata
- Download URL: otter-assign-0.0.2.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfb1ee0c20c1b2b70715d75030e4be507c698a34249f06ff9731ddee74c0ada0 |
|
MD5 | d5c624ca6289c8a0c1cd1187c928f33e |
|
BLAKE2b-256 | 2bfbae3303b036615a2c1f7bfcb26b0465d1997bc1f89d7b09b7d05d053cbbfc |
File details
Details for the file otter_assign-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: otter_assign-0.0.2-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94cbc182eb38bf36c0710c370a1d5bb97291fafcdc68dcb7aa3c75a097e1ce77 |
|
MD5 | 5a8bc7918b123fa5cfce8b62df28f4ef |
|
BLAKE2b-256 | 43d867d988c093b1aeb585b1aa3e0579dd1cb7ca43013e0a21fb6e79b72545a9 |