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,service} ...

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] [-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

-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

service

Create and manage an otter-service

otter service [-h] {build,create,start} ...

Sub-commands:

build

Build images for an otter-service instance

otter service build [-h] [--db-host DB_HOST] [--db-port DB_PORT] [-u DB_USER]
                    [-p DB_PASS] [--image IMAGE] [-q]
                    repo_path
Positional Arguments
repo_path

Path to assignments repo root

Default: “.”

Named Arguments
--db-host

Postgres database host

Default: “localhost”

--db-port

Postgres database port

Default: 5432

-u, --db-user

Postgres database user

Default: “root”

-p, --db-pass

Postgres database password

Default: “root”

--image

Based image for grading containers

Default: “ucbdsinfra/otter-grader”

-q, --quiet

Build images without writing Docker messages to stdout

create

Create database for otter-service

otter service create [-h] [--db-host DB_HOST] [--db-port DB_PORT] [-u DB_USER]
                     [-p DB_PASS]
Named Arguments
--db-host

Postgres database host

Default: “localhost”

--db-port

Postgres database port

Default: 5432

-u, --db-user

Postgres database user

Default: “root”

-p, --db-pass

Postgres database password

Default: “root”

start

Start an otter-service instance

otter service start [-h] [-c CONFIG] [-e ENDPOINT] [--port PORT]
                    [-k GOOGLE_KEY] [-s GOOGLE_SECRET] [--db-host DB_HOST]
                    [--db-port DB_PORT] [-u DB_USER] [-p DB_PASS]
                    [-l RATE_LIMIT]
Named Arguments
-c, --config

Path to config file

-e, --endpoint

Address of this VM including port

--port

Port for server to listen on

Default: 80

-k, --google-key

Google OAuth key; use environment variable if not specified

-s, --google-secret

Google OAuth secret; use environment variable if not specified

--db-host

Postgres database host

Default: “localhost”

--db-port

Postgres database port

Default: 5432

-u, --db-user

Postgres database user

Default: “root”

-p, --db-pass

Postgres database password

Default: “root”

-l, --rate-limit

Rate limit for submissions in seconds

Default: 120