Skip to main content

CodEval

CI codecov PyPI

A Python utility to download student submissions to programming assignments from Canvas and GitHub and evaluate them using codeval scripts.

Team

  • Sabira Abdolcader (sabdolc)
  • Chelsie Chen (cChe1z)
  • Aisha Syed (aisha-syed)
  • Zarah Taufique (zarahtau)

Prerequisites

  • Python 3.x
  • Docker (for running evaluations in containers)
  • A Canvas account with API access
  • A GitHub account (for GitHub-based assignments)
  • Optional AI provider packages: anthropic, openai, google-generativeai

Installation

# Install locally for development
pip install -e .

# Or install from PyPI
pip install assignment-codeval

# Install with AI provider support
pip install assignment-codeval[ai]

Configuration

Create a codeval.ini file with your Canvas and run settings:

[SERVER]
url=<canvas API>
token=<canvas token>
[RUN]
precommand=
command=

For distributed assignments, add:

[RUN]
dist_command=
host_ip=
[MONGO]
url=
db=

For AI benchmarking, add:

[AI]
anthropic_key=sk-ant-...
openai_key=sk-...
google_key=...

AI keys can also be set via environment variables: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY.

Refer to a sample config file here

Running the Application

# List all available commands
assignment-codeval --help

# Download submissions from Canvas/GitHub
assignment-codeval download-submissions <course_name>

# Evaluate downloaded submissions
assignment-codeval evaluate-submissions <course_name>

# Upload grading comments back to Canvas
assignment-codeval upload-submission-comments <course_name>

# Create an assignment on Canvas
assignment-codeval create-assignment <course_name> <specification_file>

# Check which submissions are missing grading
assignment-codeval check-grading <course_name>

# List recent codeval comments
assignment-codeval recent-comments <course_name>

# Test an assignment with AI models
assignment-codeval test-with-ai <codeval_file> [OPTIONS]

Usage

Codeval Specification Files

Codeval files (.codeval extension) define how to build, run, and test student submissions.

Assignment Description Tags

  • ASSIGNMENT START <Assignment_name> — begins the Canvas assignment description in markdown (CRT_HW START also accepted, but deprecated)
  • ASSIGNMENT END — ends the assignment description (CRT_HW END also accepted, but deprecated)

Specification Tags

Tag Meaning Function
C Compile Code Specifies the command to compile the submission code
CTO Compile Timeout Timeout in seconds for the whole evaluation (compile and all test cases) to run
T/HT Test Case Command to run to test the submission (HT = hidden test)
I/IB/IF Supply Input Input for a test case. I adds a newline, IB does not, IF reads from a file
O/OB/OF Check Output Expected output. O adds a newline, OB does not, OF reads from a file
E/EB Check Error Expected error output. E adds a newline, EB does not
TO Timeout Time limit in seconds for a test case (default: 10)
X Exit Code Expected exit code for a test case (not checked unless X is specified)
TEMP Temp File Registers a file to be deleted before and after the next test run
CF Check Function Checks that a function is used in the submission
NCF Check Not Function Checks that a function is not used
CMD/TCMD Run Command Runs a command. TCMD fails evaluation if the command errors
PRINT Print Label Prints a label/message to stdout
CMP Compare Compares two files
Z Download Zip Zip files to download from Canvas for test cases

Assignment Description Macros

Macro Replacement
DISCSN_URL URL of the discussion created for the assignment
EXMPLS <n> First n non-hidden test cases formatted for display
FILE[file_name] Link to the specified file in the Codeval folder
COMPILE Compile command from the C tag
GITHUB_DIRECTORY GitHub directory for submission

Example Specification File

ASSIGNMENT START Hello World
# Hello World

## Problem Statement
Write a C program that reads a name from stdin and prints `Hello, <name>!`

## Submission
Submit your code to GITHUB_DIRECTORY

## Sample Examples
EXMPLS 2

## Discussion
DISCSN_URL

ASSIGNMENT END

# Compile the submission
C gcc -o hello hello.c

# Test case 1: greet "World"
T ./hello
I World
O Hello, World!

# Test case 2: greet "Alice"
T ./hello
I Alice
O Hello, Alice!

AI Benchmarking

Test assignments against multiple AI models:

# Test with all Anthropic models
assignment-codeval test-with-ai my_assignment.codeval -p anthropic

# Test with a specific model, 3 attempts
assignment-codeval test-with-ai my_assignment.codeval -m "Claude Sonnet 4" -n 3
Option Description
-o, --output-dir Directory to store solutions and results (default: ai_test_results)
-n, --attempts Number of attempts per model (default: 1)
-m, --models Specific models to test (repeatable)
-p, --providers Filter by provider: anthropic, openai, google

Project Structure

src/assignment_codeval/
├── cli.py              # Click CLI entry point, registers all subcommands
├── submissions.py      # Download/upload submissions, list assignments
├── evaluate.py         # Run evaluation on submissions (run-evaluation)
├── create_assignment.py # Create assignments on Canvas
├── github_connect.py   # GitHub repository setup and integration
├── canvas_utils.py     # Canvas API utilities
├── ai_benchmark.py     # AI model testing (test-with-ai)
├── install_assignment.py # Install codeval files to local/remote destinations
├── recent_comments.py  # List recent codeval comments on Canvas
├── check_grading.py    # Check which submissions are missing grading
├── export_tests.py     # Export test cases from codeval files
├── convertMD2Html.py   # Markdown to HTML conversion
├── commons.py          # Shared utilities
├── file_utils.py       # File handling utilities
└── test_template.html  # HTML template for test results

tests/
├── unit/               # Unit tests and sample programs/codeval fixtures
├── integration/
│   └── test_codeval.py # Integration test suite
└── e2e/
    └── test_e2e.py     # End-to-end tests

samples/
├── codeval.ini               # Sample configuration file
└── assignment-name.codeval   # Sample specification file

Metadata

Release files for assignment-codeval 0.0.33

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for assignment-codeval 0.0.33
File Size Uploaded
assignment_codeval-0.0.33.tar.gz 52.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for assignment-codeval 0.0.33
File Interpreter ABI Platform
assignment_codeval-0.0.33-py3-none-any.whl Python 3 none any Details

Total release size: 107.6 kB

Release files / assignment_codeval-0.0.33.tar.gz

Download URL assignment_codeval-0.0.33.tar.gz
Size 52.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8160c4fc33e742a6c6a7e904760d9c927f7056c130726483233e5c190b4588e3
BLAKE2b-256 checksum
How to use checksums
cd3566e4f29b3ce68c84ca0b0ca9e6991530d09bf21ee02c14886775cde223d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / assignment_codeval-0.0.33-py3-none-any.whl

Download URL assignment_codeval-0.0.33-py3-none-any.whl
Size 55.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
565031e411abd5522db51b04a2b21a87db7df6fd52babf498be726a93023e970
BLAKE2b-256 checksum
How to use checksums
e1969a669d5f2b586a14b2cf928e60301d30ac64e65c39057991ee03a34b8590
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

0.0.34

2 release files

This release

0.0.33 This release

2 release files

0.0.32

2 release files

0.0.30

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page