otter.api Reference¶
A programmatic API for using Otter-Grader
- otter.api.export_notebook(nb_path, dest=None, exporter_type=None, **kwargs)¶
Exports a notebook file at
nb_pathto a PDF with optional filtering and pagebreaks. Accepts otherkwargspassed to the exporter class’sconvert_notebookclass method.- Parameters
nb_path (
str) – path to notebookdest (
str, optional) – path to write PDFexporter_type (
str, optional) – the type of exporter to use; one of['html', 'latex']**kwargs – additional configurations passed to exporter
- Returns
the path at which the PDF was written
- Return type
str
- otter.api.grade_submission(submission_path, ag_path='autograder.zip', quiet=False, debug=False)¶
Runs non-containerized grading on a single submission at
submission_pathusing the autograder configuration file atag_path.Creates a temporary grading directory using the
tempfilelibrary and grades the submission by replicating the autograder tree structure in that folder and running the autograder there. Does not run environment setup files (e.g.setup.sh) or install requirements, so any requirements should be available in the environment being used for grading.Print statements executed during grading can be suppressed with
quiet.- Parameters
submission_path (
str) – path to submission fileag_path (
str) – path to autograder zip filequiet (
bool, optional) – whether to suppress print statements during grading; defaultFalsedebug (
bool, optional) – whether to run the submission in debug mode (without ignoring errors)
- Returns
- the results object produced during the grading of the
submission.
- Return type
otter.test_files.GradingResults