assignment-codeval 0.0.30__tar.gz → 0.0.31__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- assignment_codeval-0.0.31/PKG-INFO +243 -0
- assignment_codeval-0.0.31/README.md +222 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/pyproject.toml +2 -2
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/ai_benchmark.py +2 -2
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/convertMD2Html.py +182 -180
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/create_assignment.py +7 -5
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/evaluate.py +4 -4
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/export_tests.py +2 -2
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/submissions.py +176 -13
- assignment_codeval-0.0.31/src/assignment_codeval/t.html +2 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/test_template.html +76 -9
- assignment_codeval-0.0.31/src/assignment_codeval.egg-info/PKG-INFO +243 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval.egg-info/SOURCES.txt +2 -8
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval.egg-info/requires.txt +1 -0
- assignment_codeval-0.0.30/PKG-INFO +0 -351
- assignment_codeval-0.0.30/README.md +0 -331
- assignment_codeval-0.0.30/src/assignment_codeval.egg-info/PKG-INFO +0 -351
- assignment_codeval-0.0.30/tests/test_check_grading.py +0 -68
- assignment_codeval-0.0.30/tests/test_codeval.py +0 -107
- assignment_codeval-0.0.30/tests/test_create_assignment.py +0 -481
- assignment_codeval-0.0.30/tests/test_evaluate_submissions.py +0 -312
- assignment_codeval-0.0.30/tests/test_export_tests.py +0 -172
- assignment_codeval-0.0.30/tests/test_function_detection.py +0 -411
- assignment_codeval-0.0.30/tests/test_install_assignment.py +0 -183
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/setup.cfg +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/__init__.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/canvas_utils.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/check_grading.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/cli.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/commons.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/file_utils.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/github_connect.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/install_assignment.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/recent_comments.py +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval.egg-info/dependency_links.txt +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval.egg-info/entry_points.txt +0 -0
- {assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: assignment-codeval
|
|
3
|
+
Version: 0.0.31
|
|
4
|
+
Summary: CodEval for evaluating programming assignments
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: canvasapi==3.3.0
|
|
8
|
+
Requires-Dist: click==8.2.1
|
|
9
|
+
Requires-Dist: configparser==5.2.0
|
|
10
|
+
Requires-Dist: pytz==2021.3
|
|
11
|
+
Requires-Dist: requests>=2.28.0
|
|
12
|
+
Requires-Dist: pymongo==4.3.3
|
|
13
|
+
Requires-Dist: markdown==3.4.1
|
|
14
|
+
Requires-Dist: mdx-better-lists>=1.0.0
|
|
15
|
+
Requires-Dist: anthropic>=0.39.0
|
|
16
|
+
Requires-Dist: openai>=1.0.0
|
|
17
|
+
Requires-Dist: google-generativeai>=0.8.0
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
20
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
21
|
+
|
|
22
|
+
# CodEval
|
|
23
|
+
|
|
24
|
+
[](https://github.com/SJSU-CMPE-195/group-project-team-29/actions/workflows/test.yml)
|
|
25
|
+
[](https://codecov.io/gh/SJSU-CMPE-195/group-project-team-29)
|
|
26
|
+
[](https://pypi.org/project/assignment-codeval/)
|
|
27
|
+
|
|
28
|
+
A Python utility to download student submissions to programming assignments from Canvas and GitHub and evaluate them using codeval scripts.
|
|
29
|
+
|
|
30
|
+
## Team
|
|
31
|
+
- Sabira Abdolcader (sabdolc)
|
|
32
|
+
- Chelsie Chen (cChe1z)
|
|
33
|
+
- Aisha Syed (aisha-syed)
|
|
34
|
+
- Zarah Taufique (zarahtau)
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
- Python 3.x
|
|
38
|
+
- Docker (for running evaluations in containers)
|
|
39
|
+
- A Canvas account with API access
|
|
40
|
+
- A GitHub account (for GitHub-based assignments)
|
|
41
|
+
- Optional AI provider packages: `anthropic`, `openai`, `google-generativeai`
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Install locally for development
|
|
47
|
+
pip install -e .
|
|
48
|
+
|
|
49
|
+
# Or install from PyPI
|
|
50
|
+
pip install assignment-codeval
|
|
51
|
+
|
|
52
|
+
# Install with AI provider support
|
|
53
|
+
pip install assignment-codeval[ai]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
Create a `codeval.ini` file with your Canvas and run settings:
|
|
59
|
+
|
|
60
|
+
```ini
|
|
61
|
+
[SERVER]
|
|
62
|
+
url=<canvas API>
|
|
63
|
+
token=<canvas token>
|
|
64
|
+
[RUN]
|
|
65
|
+
precommand=
|
|
66
|
+
command=
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For distributed assignments, add:
|
|
70
|
+
```ini
|
|
71
|
+
[RUN]
|
|
72
|
+
dist_command=
|
|
73
|
+
host_ip=
|
|
74
|
+
[MONGO]
|
|
75
|
+
url=
|
|
76
|
+
db=
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For AI benchmarking, add:
|
|
80
|
+
```ini
|
|
81
|
+
[AI]
|
|
82
|
+
anthropic_key=sk-ant-...
|
|
83
|
+
openai_key=sk-...
|
|
84
|
+
google_key=...
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
AI keys can also be set via environment variables: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY`.
|
|
88
|
+
|
|
89
|
+
Refer to a sample config file [here](samples/codeval.ini)
|
|
90
|
+
|
|
91
|
+
## Running the Application
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# List all available commands
|
|
95
|
+
assignment-codeval --help
|
|
96
|
+
|
|
97
|
+
# Download submissions from Canvas/GitHub
|
|
98
|
+
assignment-codeval download-submissions <course_name>
|
|
99
|
+
|
|
100
|
+
# Evaluate downloaded submissions
|
|
101
|
+
assignment-codeval evaluate-submissions <course_name>
|
|
102
|
+
|
|
103
|
+
# Upload grading comments back to Canvas
|
|
104
|
+
assignment-codeval upload-submission-comments <course_name>
|
|
105
|
+
|
|
106
|
+
# Create an assignment on Canvas
|
|
107
|
+
assignment-codeval create-assignment <course_name> <specification_file>
|
|
108
|
+
|
|
109
|
+
# Check which submissions are missing grading
|
|
110
|
+
assignment-codeval check-grading <course_name>
|
|
111
|
+
|
|
112
|
+
# List recent codeval comments
|
|
113
|
+
assignment-codeval recent-comments <course_name>
|
|
114
|
+
|
|
115
|
+
# Test an assignment with AI models
|
|
116
|
+
assignment-codeval test-with-ai <codeval_file> [OPTIONS]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Usage
|
|
120
|
+
|
|
121
|
+
### Codeval Specification Files
|
|
122
|
+
|
|
123
|
+
Codeval files (`.codeval` extension) define how to build, run, and test student submissions.
|
|
124
|
+
|
|
125
|
+
#### Assignment Description Tags
|
|
126
|
+
- `ASSIGNMENT START <Assignment_name>` — begins the Canvas assignment description in markdown (`CRT_HW START` also accepted, but deprecated)
|
|
127
|
+
- `ASSIGNMENT END` — ends the assignment description (`CRT_HW END` also accepted, but deprecated)
|
|
128
|
+
|
|
129
|
+
#### Specification Tags
|
|
130
|
+
|
|
131
|
+
| Tag | Meaning | Function |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| C | Compile Code | Specifies the command to compile the submission code |
|
|
134
|
+
| CTO | Compile Timeout | Timeout in seconds for the compile command to run |
|
|
135
|
+
| T/HT | Test Case | Command to run to test the submission (HT = hidden test) |
|
|
136
|
+
| I/IB/IF | Supply Input | Input for a test case. I adds a newline, IB does not, IF reads from a file |
|
|
137
|
+
| O/OB/OF | Check Output | Expected output. O adds a newline, OB does not, OF reads from a file |
|
|
138
|
+
| E/EB | Check Error | Expected error output. E adds a newline, EB does not |
|
|
139
|
+
| TO | Timeout | Time limit in seconds for a test case (default: 20) |
|
|
140
|
+
| X | Exit Code | Expected exit code for a test case (default: 0) |
|
|
141
|
+
| TEMP | Temp File | Registers a file to be deleted before and after the next test run |
|
|
142
|
+
| CF | Check Function | Checks that a function is used in the submission |
|
|
143
|
+
| NCF | Check Not Function | Checks that a function is **not** used |
|
|
144
|
+
| CMD/TCMD | Run Command | Runs a command. TCMD fails evaluation if the command errors |
|
|
145
|
+
| PRINT | Print Label | Prints a label/message to stdout |
|
|
146
|
+
| CMP | Compare | Compares two files |
|
|
147
|
+
| Z | Download Zip | Zip files to download from Canvas for test cases |
|
|
148
|
+
| SS | Start Server | Starts a server with timeout and kill-timeout settings |
|
|
149
|
+
|
|
150
|
+
#### Assignment Description Macros
|
|
151
|
+
|
|
152
|
+
| Macro | Replacement |
|
|
153
|
+
|---|---|
|
|
154
|
+
| `DISCSN_URL` | URL of the discussion created for the assignment |
|
|
155
|
+
| `EXMPLS <n>` | First `n` non-hidden test cases formatted for display |
|
|
156
|
+
| `FILE[file_name]` | Link to the specified file in the Codeval folder |
|
|
157
|
+
| `COMPILE` | Compile command from the `C` tag |
|
|
158
|
+
| `GITHUB_DIRECTORY` | GitHub directory for submission |
|
|
159
|
+
|
|
160
|
+
#### Example Specification File
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
ASSIGNMENT START Hello World
|
|
164
|
+
# Hello World
|
|
165
|
+
|
|
166
|
+
## Problem Statement
|
|
167
|
+
Write a C program that reads a name from stdin and prints `Hello, <name>!`
|
|
168
|
+
|
|
169
|
+
## Submission
|
|
170
|
+
Submit your code to GITHUB_DIRECTORY
|
|
171
|
+
|
|
172
|
+
## Sample Examples
|
|
173
|
+
EXMPLS 2
|
|
174
|
+
|
|
175
|
+
## Discussion
|
|
176
|
+
DISCSN_URL
|
|
177
|
+
|
|
178
|
+
ASSIGNMENT END
|
|
179
|
+
|
|
180
|
+
# Compile the submission
|
|
181
|
+
C gcc -o hello hello.c
|
|
182
|
+
|
|
183
|
+
# Test case 1: greet "World"
|
|
184
|
+
T ./hello
|
|
185
|
+
I World
|
|
186
|
+
O Hello, World!
|
|
187
|
+
|
|
188
|
+
# Test case 2: greet "Alice"
|
|
189
|
+
T ./hello
|
|
190
|
+
I Alice
|
|
191
|
+
O Hello, Alice!
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### AI Benchmarking
|
|
195
|
+
|
|
196
|
+
Test assignments against multiple AI models:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Test with all Anthropic models
|
|
200
|
+
assignment-codeval test-with-ai my_assignment.codeval -p anthropic
|
|
201
|
+
|
|
202
|
+
# Test with a specific model, 3 attempts
|
|
203
|
+
assignment-codeval test-with-ai my_assignment.codeval -m "Claude Sonnet 4" -n 3
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
| Option | Description |
|
|
207
|
+
|--------|-------------|
|
|
208
|
+
| `-o, --output-dir` | Directory to store solutions and results (default: `ai_test_results`) |
|
|
209
|
+
| `-n, --attempts` | Number of attempts per model (default: 1) |
|
|
210
|
+
| `-m, --models` | Specific models to test (repeatable) |
|
|
211
|
+
| `-p, --providers` | Filter by provider: `anthropic`, `openai`, `google` |
|
|
212
|
+
|
|
213
|
+
## Project Structure
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
src/assignment_codeval/
|
|
217
|
+
├── cli.py # Click CLI entry point, registers all subcommands
|
|
218
|
+
├── submissions.py # Download/upload submissions, list assignments
|
|
219
|
+
├── evaluate.py # Run evaluation on submissions (run-evaluation)
|
|
220
|
+
├── create_assignment.py # Create assignments on Canvas
|
|
221
|
+
├── github_connect.py # GitHub repository setup and integration
|
|
222
|
+
├── canvas_utils.py # Canvas API utilities
|
|
223
|
+
├── ai_benchmark.py # AI model testing (test-with-ai)
|
|
224
|
+
├── install_assignment.py # Install codeval files to local/remote destinations
|
|
225
|
+
├── recent_comments.py # List recent codeval comments on Canvas
|
|
226
|
+
├── check_grading.py # Check which submissions are missing grading
|
|
227
|
+
├── export_tests.py # Export test cases from codeval files
|
|
228
|
+
├── convertMD2Html.py # Markdown to HTML conversion
|
|
229
|
+
├── commons.py # Shared utilities
|
|
230
|
+
├── file_utils.py # File handling utilities
|
|
231
|
+
└── test_template.html # HTML template for test results
|
|
232
|
+
|
|
233
|
+
tests/
|
|
234
|
+
├── unit/ # Unit tests and sample programs/codeval fixtures
|
|
235
|
+
├── integration/
|
|
236
|
+
│ └── test_codeval.py # Integration test suite
|
|
237
|
+
└── e2e/
|
|
238
|
+
└── test_e2e.py # End-to-end tests
|
|
239
|
+
|
|
240
|
+
samples/
|
|
241
|
+
├── codeval.ini # Sample configuration file
|
|
242
|
+
└── assignment-name.codeval # Sample specification file
|
|
243
|
+
```
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# CodEval
|
|
2
|
+
|
|
3
|
+
[](https://github.com/SJSU-CMPE-195/group-project-team-29/actions/workflows/test.yml)
|
|
4
|
+
[](https://codecov.io/gh/SJSU-CMPE-195/group-project-team-29)
|
|
5
|
+
[](https://pypi.org/project/assignment-codeval/)
|
|
6
|
+
|
|
7
|
+
A Python utility to download student submissions to programming assignments from Canvas and GitHub and evaluate them using codeval scripts.
|
|
8
|
+
|
|
9
|
+
## Team
|
|
10
|
+
- Sabira Abdolcader (sabdolc)
|
|
11
|
+
- Chelsie Chen (cChe1z)
|
|
12
|
+
- Aisha Syed (aisha-syed)
|
|
13
|
+
- Zarah Taufique (zarahtau)
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
- Python 3.x
|
|
17
|
+
- Docker (for running evaluations in containers)
|
|
18
|
+
- A Canvas account with API access
|
|
19
|
+
- A GitHub account (for GitHub-based assignments)
|
|
20
|
+
- Optional AI provider packages: `anthropic`, `openai`, `google-generativeai`
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install locally for development
|
|
26
|
+
pip install -e .
|
|
27
|
+
|
|
28
|
+
# Or install from PyPI
|
|
29
|
+
pip install assignment-codeval
|
|
30
|
+
|
|
31
|
+
# Install with AI provider support
|
|
32
|
+
pip install assignment-codeval[ai]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Configuration
|
|
36
|
+
|
|
37
|
+
Create a `codeval.ini` file with your Canvas and run settings:
|
|
38
|
+
|
|
39
|
+
```ini
|
|
40
|
+
[SERVER]
|
|
41
|
+
url=<canvas API>
|
|
42
|
+
token=<canvas token>
|
|
43
|
+
[RUN]
|
|
44
|
+
precommand=
|
|
45
|
+
command=
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For distributed assignments, add:
|
|
49
|
+
```ini
|
|
50
|
+
[RUN]
|
|
51
|
+
dist_command=
|
|
52
|
+
host_ip=
|
|
53
|
+
[MONGO]
|
|
54
|
+
url=
|
|
55
|
+
db=
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For AI benchmarking, add:
|
|
59
|
+
```ini
|
|
60
|
+
[AI]
|
|
61
|
+
anthropic_key=sk-ant-...
|
|
62
|
+
openai_key=sk-...
|
|
63
|
+
google_key=...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
AI keys can also be set via environment variables: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY`.
|
|
67
|
+
|
|
68
|
+
Refer to a sample config file [here](samples/codeval.ini)
|
|
69
|
+
|
|
70
|
+
## Running the Application
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# List all available commands
|
|
74
|
+
assignment-codeval --help
|
|
75
|
+
|
|
76
|
+
# Download submissions from Canvas/GitHub
|
|
77
|
+
assignment-codeval download-submissions <course_name>
|
|
78
|
+
|
|
79
|
+
# Evaluate downloaded submissions
|
|
80
|
+
assignment-codeval evaluate-submissions <course_name>
|
|
81
|
+
|
|
82
|
+
# Upload grading comments back to Canvas
|
|
83
|
+
assignment-codeval upload-submission-comments <course_name>
|
|
84
|
+
|
|
85
|
+
# Create an assignment on Canvas
|
|
86
|
+
assignment-codeval create-assignment <course_name> <specification_file>
|
|
87
|
+
|
|
88
|
+
# Check which submissions are missing grading
|
|
89
|
+
assignment-codeval check-grading <course_name>
|
|
90
|
+
|
|
91
|
+
# List recent codeval comments
|
|
92
|
+
assignment-codeval recent-comments <course_name>
|
|
93
|
+
|
|
94
|
+
# Test an assignment with AI models
|
|
95
|
+
assignment-codeval test-with-ai <codeval_file> [OPTIONS]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Usage
|
|
99
|
+
|
|
100
|
+
### Codeval Specification Files
|
|
101
|
+
|
|
102
|
+
Codeval files (`.codeval` extension) define how to build, run, and test student submissions.
|
|
103
|
+
|
|
104
|
+
#### Assignment Description Tags
|
|
105
|
+
- `ASSIGNMENT START <Assignment_name>` — begins the Canvas assignment description in markdown (`CRT_HW START` also accepted, but deprecated)
|
|
106
|
+
- `ASSIGNMENT END` — ends the assignment description (`CRT_HW END` also accepted, but deprecated)
|
|
107
|
+
|
|
108
|
+
#### Specification Tags
|
|
109
|
+
|
|
110
|
+
| Tag | Meaning | Function |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| C | Compile Code | Specifies the command to compile the submission code |
|
|
113
|
+
| CTO | Compile Timeout | Timeout in seconds for the compile command to run |
|
|
114
|
+
| T/HT | Test Case | Command to run to test the submission (HT = hidden test) |
|
|
115
|
+
| I/IB/IF | Supply Input | Input for a test case. I adds a newline, IB does not, IF reads from a file |
|
|
116
|
+
| O/OB/OF | Check Output | Expected output. O adds a newline, OB does not, OF reads from a file |
|
|
117
|
+
| E/EB | Check Error | Expected error output. E adds a newline, EB does not |
|
|
118
|
+
| TO | Timeout | Time limit in seconds for a test case (default: 20) |
|
|
119
|
+
| X | Exit Code | Expected exit code for a test case (default: 0) |
|
|
120
|
+
| TEMP | Temp File | Registers a file to be deleted before and after the next test run |
|
|
121
|
+
| CF | Check Function | Checks that a function is used in the submission |
|
|
122
|
+
| NCF | Check Not Function | Checks that a function is **not** used |
|
|
123
|
+
| CMD/TCMD | Run Command | Runs a command. TCMD fails evaluation if the command errors |
|
|
124
|
+
| PRINT | Print Label | Prints a label/message to stdout |
|
|
125
|
+
| CMP | Compare | Compares two files |
|
|
126
|
+
| Z | Download Zip | Zip files to download from Canvas for test cases |
|
|
127
|
+
| SS | Start Server | Starts a server with timeout and kill-timeout settings |
|
|
128
|
+
|
|
129
|
+
#### Assignment Description Macros
|
|
130
|
+
|
|
131
|
+
| Macro | Replacement |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `DISCSN_URL` | URL of the discussion created for the assignment |
|
|
134
|
+
| `EXMPLS <n>` | First `n` non-hidden test cases formatted for display |
|
|
135
|
+
| `FILE[file_name]` | Link to the specified file in the Codeval folder |
|
|
136
|
+
| `COMPILE` | Compile command from the `C` tag |
|
|
137
|
+
| `GITHUB_DIRECTORY` | GitHub directory for submission |
|
|
138
|
+
|
|
139
|
+
#### Example Specification File
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
ASSIGNMENT START Hello World
|
|
143
|
+
# Hello World
|
|
144
|
+
|
|
145
|
+
## Problem Statement
|
|
146
|
+
Write a C program that reads a name from stdin and prints `Hello, <name>!`
|
|
147
|
+
|
|
148
|
+
## Submission
|
|
149
|
+
Submit your code to GITHUB_DIRECTORY
|
|
150
|
+
|
|
151
|
+
## Sample Examples
|
|
152
|
+
EXMPLS 2
|
|
153
|
+
|
|
154
|
+
## Discussion
|
|
155
|
+
DISCSN_URL
|
|
156
|
+
|
|
157
|
+
ASSIGNMENT END
|
|
158
|
+
|
|
159
|
+
# Compile the submission
|
|
160
|
+
C gcc -o hello hello.c
|
|
161
|
+
|
|
162
|
+
# Test case 1: greet "World"
|
|
163
|
+
T ./hello
|
|
164
|
+
I World
|
|
165
|
+
O Hello, World!
|
|
166
|
+
|
|
167
|
+
# Test case 2: greet "Alice"
|
|
168
|
+
T ./hello
|
|
169
|
+
I Alice
|
|
170
|
+
O Hello, Alice!
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### AI Benchmarking
|
|
174
|
+
|
|
175
|
+
Test assignments against multiple AI models:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Test with all Anthropic models
|
|
179
|
+
assignment-codeval test-with-ai my_assignment.codeval -p anthropic
|
|
180
|
+
|
|
181
|
+
# Test with a specific model, 3 attempts
|
|
182
|
+
assignment-codeval test-with-ai my_assignment.codeval -m "Claude Sonnet 4" -n 3
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
| Option | Description |
|
|
186
|
+
|--------|-------------|
|
|
187
|
+
| `-o, --output-dir` | Directory to store solutions and results (default: `ai_test_results`) |
|
|
188
|
+
| `-n, --attempts` | Number of attempts per model (default: 1) |
|
|
189
|
+
| `-m, --models` | Specific models to test (repeatable) |
|
|
190
|
+
| `-p, --providers` | Filter by provider: `anthropic`, `openai`, `google` |
|
|
191
|
+
|
|
192
|
+
## Project Structure
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
src/assignment_codeval/
|
|
196
|
+
├── cli.py # Click CLI entry point, registers all subcommands
|
|
197
|
+
├── submissions.py # Download/upload submissions, list assignments
|
|
198
|
+
├── evaluate.py # Run evaluation on submissions (run-evaluation)
|
|
199
|
+
├── create_assignment.py # Create assignments on Canvas
|
|
200
|
+
├── github_connect.py # GitHub repository setup and integration
|
|
201
|
+
├── canvas_utils.py # Canvas API utilities
|
|
202
|
+
├── ai_benchmark.py # AI model testing (test-with-ai)
|
|
203
|
+
├── install_assignment.py # Install codeval files to local/remote destinations
|
|
204
|
+
├── recent_comments.py # List recent codeval comments on Canvas
|
|
205
|
+
├── check_grading.py # Check which submissions are missing grading
|
|
206
|
+
├── export_tests.py # Export test cases from codeval files
|
|
207
|
+
├── convertMD2Html.py # Markdown to HTML conversion
|
|
208
|
+
├── commons.py # Shared utilities
|
|
209
|
+
├── file_utils.py # File handling utilities
|
|
210
|
+
└── test_template.html # HTML template for test results
|
|
211
|
+
|
|
212
|
+
tests/
|
|
213
|
+
├── unit/ # Unit tests and sample programs/codeval fixtures
|
|
214
|
+
├── integration/
|
|
215
|
+
│ └── test_codeval.py # Integration test suite
|
|
216
|
+
└── e2e/
|
|
217
|
+
└── test_e2e.py # End-to-end tests
|
|
218
|
+
|
|
219
|
+
samples/
|
|
220
|
+
├── codeval.ini # Sample configuration file
|
|
221
|
+
└── assignment-name.codeval # Sample specification file
|
|
222
|
+
```
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "assignment-codeval"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.31"
|
|
8
8
|
description = "CodEval for evaluating programming assignments"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -23,7 +23,7 @@ dependencies = [
|
|
|
23
23
|
]
|
|
24
24
|
|
|
25
25
|
[project.optional-dependencies]
|
|
26
|
-
test = ["pytest>=7.0"]
|
|
26
|
+
test = ["pytest>=7.0", "pytest-cov"]
|
|
27
27
|
|
|
28
28
|
[project.scripts]
|
|
29
29
|
assignment-codeval = "assignment_codeval.cli:cli"
|
{assignment_codeval-0.0.30 → assignment_codeval-0.0.31}/src/assignment_codeval/ai_benchmark.py
RENAMED
|
@@ -75,8 +75,8 @@ def extract_assignment_from_codeval(codeval_path: str) -> tuple[str, str, str]:
|
|
|
75
75
|
with open(codeval_path, "r", encoding="utf-8") as f:
|
|
76
76
|
content = f.read()
|
|
77
77
|
|
|
78
|
-
# Extract content between CRT_HW START and CRT_HW END
|
|
79
|
-
match = re.search(r"CRT_HW START \S+\n(.*?)CRT_HW END", content, re.DOTALL)
|
|
78
|
+
# Extract content between ASSIGNMENT START / CRT_HW START and ASSIGNMENT END / CRT_HW END
|
|
79
|
+
match = re.search(r"(?:ASSIGNMENT START|CRT_HW START) \S+\n(.*?)(?:ASSIGNMENT END|CRT_HW END)", content, re.DOTALL)
|
|
80
80
|
if match:
|
|
81
81
|
description = match.group(1).strip()
|
|
82
82
|
else:
|