GradeScope Data Types¶
Input Data Types API¶
The JSON schemas for Gradescope's metadata.
GradescopeAssignmentMetadata dataclass
¶
The JSON schema for Gradescope's assignment settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
due_date | datetime | The assignment's due date. | required |
group_size | Optional[int] | The maximum group size on a group assignment. | required |
group_submission | bool | Whether group submission is allowed. | required |
id | int | The assignment's ID. | required |
course_id | int | The course's ID. | required |
late_due_date | Optional[datetime] | The late due date, or None if late submission disallowed. | required |
release_date | datetime | The assignment's release date. | required |
title | str | The assignment's title. | required |
total_points | float | The total point value of the assignment. | required |
Source code in src/gapper/gradescope/datatypes/gradescope_meta.py
GradescopeAssignmentUser dataclass
¶
The JSON schema for a 'user' (submitter) of a Gradescope assignment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
email | str | The submitter's email. | required |
id | int | The submitter's ID. | required |
name | str | The submitter's name. | required |
Source code in src/gapper/gradescope/datatypes/gradescope_meta.py
GradescopePreviousSubmission dataclass
¶
The JSON schema for a previous submission record.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
submission_time | datetime | The time of the previous submission. | required |
score | float | The previous submission's score. | required |
results | GradescopeJson | The results.json file from the previous submission. | required |
Source code in src/gapper/gradescope/datatypes/gradescope_meta.py
GradescopeSubmissionMetadata dataclass
¶
The JSON schema for Gradescope's submission metadata.
See Also https://gradescope-autograders.readthedocs.io/en/latest/submission_metadata/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id | int | The submission's ID. | required |
created_at | datetime | The time the submission was created. | required |
assignment | GradescopeAssignmentMetadata | The assignment's metadata. | required |
submission_method | Literal['upload', 'GitHub', 'Bitbucket'] | The submission method. | required |
users | List[GradescopeAssignmentUser] | The submitters' metadata. | required |
previous_submissions | List[GradescopePreviousSubmission] | The previous submissions' metadata. | required |
Source code in src/gapper/gradescope/datatypes/gradescope_meta.py
from_file classmethod
¶
Load the submission metadata from a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | Path | The path to load the submission metadata from. | required |
Source code in src/gapper/gradescope/datatypes/gradescope_meta.py
Output Data Types API¶
The Gradescope grading output JSON schema.
GradescopeJson dataclass
¶
The JSON schema for Gradescope.
We currently don't support the leaderboard and extra_data features of the gradescope schema. Those are documented on the autograder documentation, here: https://gradescope-autograders.readthedocs.io/en/latest/specs/.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tests | list[GradescopeTestJson] | The tests for the problem. Required if no global score provided. | list() |
score | Optional[float] | The overall score. Required if any test has no set score. | None |
execution_time | Optional[int] | The execution time of all the tests, in seconds. | None |
output | Optional[str] | The top-level, human-readable text output for all the problems. | None |
visibility | VisibilityType | The default visibility for each test. Overridden by test-specific settings. | 'visible' |
stdout_visibility | Optional[str] | Whether to show stdout for the tests. Same options as for visibility. | None |
Source code in src/gapper/gradescope/datatypes/gradescope_output.py
from_error classmethod
¶
Convert an error to Gradescope JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error | InternalError | StudentError | The error to convert. | required |
save_path | Path | None | The path to save the Gradescope JSON to. | None |
Returns:
Type | Description |
---|---|
GradescopeJson | The Gradescope JSON. |
Source code in src/gapper/gradescope/datatypes/gradescope_output.py
from_test_results classmethod
¶
from_test_results(results: List[TestResult], score: float, save_path: Path | None = None, **kwargs) -> GradescopeJson
Convert a list of test results to Gradescope JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results | List[TestResult] | The test results. | required |
score | float | The score obtained from the submission. | required |
save_path | Path | None | The path to save the Gradescope JSON to. | None |
kwargs | The keyword arguments to pass to the constructor. | {} |
Returns:
Type | Description |
---|---|
GradescopeJson | The Gradescope JSON. |
Source code in src/gapper/gradescope/datatypes/gradescope_output.py
GradescopeTestJson dataclass
¶
The JSON schema for a single Test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
score | Optional[float] | The test's score. Required if no top-level score is set. | None |
max_score | Optional[float] | The max score for the test. | None |
name | Optional[str] | The test's name. | None |
output | Optional[str] | Human-readable text output of the test. | None |
tags | Optional[str] | Tags for the test. | None |
visibility | VisibilityType | The test's visibility. "hidden", "visible", "after_due_date", "after_published" | 'visible' |
Source code in src/gapper/gradescope/datatypes/gradescope_output.py
from_test_result classmethod
¶
Convert a test result to Gradescope JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result | TestResult | The test result to convert. | required |
Returns:
Type | Description |
---|---|
GradescopeTestJson | The Gradescope Test JSON. |