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_path to a PDF with optional filtering and pagebreaks. Accepts other kwargs passed to the exporter class’s convert_notebook class method.

Parameters
  • nb_path (str) – path to notebook

  • dest (str, optional) – path to write PDF

  • exporter_type (str, optional) – the type of exporter to use; one of ['html', 'latex']

  • **kwargs – additional configurations passed to exporter

otter.api.grade_submission(submission_path, ag_path='autograder.zip', quiet=False, debug=False)

Runs non-containerized grading on a single submission at submission_path using the autograder configuration file at ag_path.

Creates a temporary grading directory using the tempfile library 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 file

  • ag_path (str) – path to autograder zip file

  • quiet (bool, optional) – whether to suppress print statements during grading; default False

  • debug (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