Batch Grading
Batch grading lets you grade a folder of student .py files at once and export the results as a CSV gradebook. This is useful for grading downloaded LMS submissions without having students run the grader themselves.
Overview
- Download student
.pyfiles from your LMS. - Open the instructor application and load your
.agrfile. - Select the assignment and the folder of student files.
- Run batch grading.
- Export the results as CSV.
Batch grading is accessed through the instructor application GUI.
Running Batch Grading
- Launch the instructor application.
- Load the
.agrfile containing the assignment you want to grade. - Select the assignment from the dropdown.
- Click Batch Grade and select the folder containing student
.pyfiles. - The grader runs each file against the assignment’s tests and displays progress.
CSV Output Format
The output CSV contains one row per student with the following columns:
| Column | Description |
|---|---|
| Student Name | Extracted from file comments or filename |
| Filename | Original .py filename |
| (test names) | One column per test, containing points earned |
| Total Points | Sum of earned points |
| Max Points | Maximum possible points |
| Percentage | Earned / max as a percentage |
| Timestamp | When grading occurred |
| Error | Error message if the script failed to execute |
Student Name Extraction
Names are extracted automatically using these strategies (in priority order):
- Comment header -
# Name: John Smithor# Student: Jane Doein the first 10 lines of the file. - Filename pattern -
Smith_John_ForLoop1.pybecomesSmith, John. - Fallback - The filename without extension.
Tip: Tell students to include a # Name: First Last comment at the top of their file for reliable name extraction.
Canvas-Compatible Export
If you are running the submission server, the dashboard provides a Canvas-compatible CSV export format. This format uses Canvas’s expected column headers for direct grade import:
- Open the submission server dashboard.
- Filter to the desired course, section, and assignment.
- Click Export Canvas CSV.
- Import the downloaded CSV into Canvas Gradebook.
See Server Setup for details on the submission server.
Import Blocklist
When running student code in the instructor application - whether through batch grading or inline testing - the system scans each file for potentially dangerous imports before execution. If a blocked module is detected, a modal prompts you to allow or deny execution on a per-student or per-module basis. This protects your machine from student code that could open network connections, spawn processes, or modify your filesystem.
The student application has no import restrictions. Students can use any module freely when running the grader themselves. The blocklist applies only in the instructor application.
How Detection Works
Before executing each student’s code, the system parses it using Python’s ast module. All import and from ... import statements are checked against the blocklist, including aliased imports like import subprocess as sp.
Default Blocked Modules
| Category | Modules | Why blocked |
|---|---|---|
| Process execution | subprocess, multiprocessing, ctypes |
Can run shell commands, spawn processes, or access C libraries |
| Networking | socket, http, urllib, smtplib, ftplib |
Can open connections, start servers, send emails, or transfer files |
| System control | webbrowser, signal |
Can open URLs in your browser or send OS signals to processes |
| File operations | shutil, glob, tempfile, zipfile, tarfile |
Can copy/delete directory trees, enumerate files, or create archives |
The Blocklist Modal
When a blocked import is found, the batch worker pauses and a modal appears showing:
- Which student file triggered the block
- The blocked module name
- A code preview with the import line highlighted in red and all usage sites highlighted in amber (including aliases)
- A reference count of how many times the module is used
You have three options:
- Allow - permit this student’s code to run (one-time, this student only).
- Deny - skip grading this student entirely. The CSV row will show an error.
- Allow All Remaining - allow this specific module for all remaining students in the batch. A safety warning confirms your choice. This does not carry over to other modules - if a later student uses a different blocked module, a new prompt appears.
Common Modules NOT Blocked
Standard modules like os, sys, math, numpy, pandas, matplotlib, re, json, csv, pathlib, collections, datetime, and random are not blocked. These are commonly used in coursework and pose minimal risk during batch grading.
Tips
- Download student files with their original filenames from your LMS when possible. This helps with name extraction.
- If students submit multiple files for multi-file assignments, keep all files for each student in the same folder.
- The grader uses the same timeout settings from the
.agrfile that students experience. - Review the Error column for files that failed to execute - common causes are syntax errors, missing imports, or
input()calls.