CLI Reference

Command-line utility for Otter-Grader, a Python-based autograder for Jupyter Notebooks, RMarkdown files, and Python and R scripts that runs locally on the instructors machine. For more information, see https://otter-grader.readthedocs.io/

usage: otter [-h] [--version] {assign,check,export,generate,grade,run} ...

Named Arguments

--version

Show version information and exit

Sub-commands:

assign

Create distribution versions of otter-assign-formatted notebook

otter assign [-h] [--no-run-tests] [--no-pdfs] [--username USERNAME]
             [--password PASSWORD] [--debug]
             master result

Positional Arguments

master

Notebook with solutions and tests.

result

Directory containing the result.

Named Arguments

--no-run-tests

Don’t run tests.

--no-pdfs

Don’t generate PDFs; overrides assignment config

--username

Gradescope username for generating a token

--password

Gradescope password for generating a token

--debug

Do not ignore errors in running tests for debugging

check

Checks Python file against tests

otter check [-h] [-q QUESTION] [-t TESTS_PATH] [--seed SEED] file

Positional Arguments

file

Python file to grade

Named Arguments

-q, --question

Grade a specific test

-t, --tests-path

Path to test files

Default: “tests”

--seed

A random seed to be executed before each cell

export

Exports a Jupyter Notebook to PDF with optional filtering

otter export [-h] [--filtering] [--pagebreaks] [-s] [-e [{latex,html}]]
             [--debug]
             source [dest]

Positional Arguments

source

Notebook to export

dest

Path to write PDF

Named Arguments

--filtering

Whether the PDF should be filtered

--pagebreaks

Whether the PDF should have pagebreaks between questions

-s, --save

Save intermediate file(s) as well

-e, --exporter

Possible choices: latex, html

Type of PDF exporter to use

--debug

Export in debug mode

generate

Generates zipfile to configure Gradescope autograder

otter generate [-h] [-t [TESTS_PATH]] [-o [OUTPUT_PATH]] [-c [CONFIG]]
               [-r [REQUIREMENTS]] [--overwrite-requirements]
               [-e [ENVIRONMENT]] [-l {python,r}]
               [--autograder-dir [AUTOGRADER_DIR]] [--username USERNAME]
               [--password PASSWORD]
               [files ...]

Positional Arguments

files

Other support files needed for grading (e.g. .py files, data files)

Named Arguments

-t, --tests-path

Path to test files

Default: “./tests/”

-o, --output-path

Path to which to write zipfile

Default: “./”

-c, --config

Path to otter configuration file; ./otter_config.json automatically checked

-r, --requirements

Path to requirements.txt file; ./requirements.txt automatically checked

--overwrite-requirements

Overwrite (rather than append to) default requirements for Gradescope; ignored if no REQUIREMENTS argument

-e, --environment

Path to environment.yml file; ./environment.yml automatically checked (overwrite)

-l, --lang

Possible choices: python, r

Assignment programming language; defaults to Python

Default: “python”

--autograder-dir

Root autograding directory inside grading container

Default: “/autograder”

--username

Gradescope username for generating a token

--password

Gradescope password for generating a token

grade

Grade assignments locally using Docker containers

otter grade [-h] [-p PATH] [-a AUTOGRADER] [-o OUTPUT_DIR] [-g] [-c] [-j JSON]
            [-y YAML] [-s] [-z] [--pdfs] [-v] [--containers CONTAINERS]
            [--image IMAGE] [--no-kill] [--debug] [--prune] [-f]

Named Arguments

-p, --path

Path to directory of submissions

Default: “./”

-a, --autograder

Path to autograder zip file

Default: “./autograder.zip”

-o, --output-dir

Directory to which to write output

Default: “./”

-g, --gradescope

Flag for Gradescope export

-c, --canvas

Flag for Canvas export

-j, --json

Flag for path to JSON metadata

Default: False

-y, --yaml

Flag for path to YAML metadata

Default: False

-s, --scripts

Flag to incidicate grading Python scripts

-z, --zips

Whether submissions are zip files from Notebook.export

--pdfs

Whether to copy notebook PDFs out of containers

-v, --verbose

Flag for verbose output

--containers

Specify number of containers to run in parallel

--image

Custom docker image to run on

Default: “ucbdsinfra/otter-grader”

--no-kill

Do not kill containers after grading

--debug

Print stdout/stderr from grading for debugging

--prune

Prune all of Otter’s grading images

-f, --force

Force action (don’t ask for confirmation)

run

Run non-containerized Otter on a single submission

otter run [-h] [-a AUTOGRADER] [-o OUTPUT_DIR] [--no-logo] [--debug]
          submission

Positional Arguments

submission

Path to submission to be graded

Named Arguments

-a, --autograder

Path to autograder zip file

Default: “./autograder.zip”

-o, --output-dir

Directory to which to write output

Default: “./”

--no-logo

Suppress Otter logo in stdout

--debug

Do not ignore errors when running submission