Skip to content

Gradescope Setup ​

Configure your Gradescope course to work with the submitter.

Step 1: Create a Gradescope Course ​

  1. Log into Gradescope
  2. Click "Create Course"
  3. Fill in course details:
    • Course name
    • School
    • Term
  4. Note your Course ID from the URL:
https://www.gradescope.com/courses/1106756
                                    ^^^^^^^
                                    This is your COURSE_ID

Step 2: Create Programming Assignments ​

For each assignment students will submit:

  1. Go to Assignments → Create Assignment
  2. Select "Programming Assignment"
  3. Configure the autograder:
    • Upload your autograder zip file
    • Set the programming language to Python
    • Configure test cases
  4. Note the Assignment ID from the URL:
https://www.gradescope.com/courses/1106756/assignments/6617143
                                                        ^^^^^^^
                                                        This is your asg_id

Autograder Setup ​

Basic Autograder Structure ​

Your autograder zip should contain:

autograder/
├── setup.sh          # Install dependencies
├── run_autograder    # Main grading script
└── tests/            # Test files

Example run_autograder ​

bash
#!/usr/bin/env bash

cd /autograder/source

# Run tests and output results
python3 -m pytest tests/ --json-report --json-report-file=/autograder/results/results.json

# Or use the Gradescope Python library
python3 run_tests.py

Example Python Test ​

python
import unittest
from gradescope_utils.autograder_utils.decorators import weight

class TestCalculateTotal(unittest.TestCase):
    @weight(10)
    def test_basic(self):
        """Test with simple list"""
        from submission import calculate_total
        result = calculate_total([10.0, 5.0, 3.0])
        self.assertEqual(result, 18.0)
    
    @weight(10)
    def test_empty(self):
        """Test with empty list"""
        from submission import calculate_total
        result = calculate_total([])
        self.assertEqual(result, 0)

Step 3: Get Your Credentials ​

You need two values from Gradescope:

Authenticity Token ​

  1. Go to any assignment submission page
  2. Open Developer Tools (F12)
  3. Look for authenticity_token in the page source or form data
  1. In Developer Tools, go to Application → Cookies
  2. Find cookies for gradescope.com
  3. Copy the entire cookie string, or specifically:
    • _gradescope_session
    • signed_token (if present)

Step 4: Add Students ​

Manual Enrollment ​

  1. Go to Roster in your course
  2. Click Add Students
  3. Enter student emails

CSV Import ​

Upload a CSV with columns:

  • email
  • name (optional)
  • student_id (optional)

LTI Sync ​

If using D2L integration, students are automatically enrolled when they first access an assignment.

Assignment URL Parameters ​

When embedding the code editor, use these URL parameters:

ParameterRequiredDescriptionExample
asg_idYesGradescope assignment ID6617143
file_nameNoFilename for submissionprogram.py
starterNoStarter code template filelab1_starter.py
emailNoPre-fill student emailstudent@school.edu
stud_idNoStudent ID900123456

Example Embed URL ​

https://your-server.com/codemirror-demo.html?asg_id=6617143&file_name=lab1.py&starter=lab1_starter.py

Next Steps ​

Released under the MIT License.