DEV Community

Aswani Kumar
Aswani Kumar

Posted on Originally published at onlinecompiler.io

GitHub Classroom has closed: how to keep auto-grading programming assignments

GitHub Classroom was deprecated as of 28 August 2026. GitHub's changelog says the Classroom website, its APIs and related services have been decommissioned, and some data is deleted for good: classroom and assignment names, tests defined outside repositories, and LTI rosters. Your GitHub accounts, organizations and assignment repositories are not affected, so the student work is still there. The grading isn't.

If you taught with Classroom, two things are worth doing this week:

  1. Export what you can. GitHub's migration page explains how to export Classroom data as JSON or CSV with the GitHub CLI. That is where your class lists and grades come from now.
  2. Rescue the tests. Most Classroom assignments were graded by input/output tests, and those move to a plain HTTP API almost one to one. This post shows how, and how to grade a whole class into a CSV file with a short Python script.

What a Classroom test looked like

The commonest Classroom test ran a command, gave it some text on standard input and compared what it printed with the expected text. A test for a program that prints its input in capital letters:

- name: Shout
  uses: classroom-resources/autograding-io-grader@v1
  with:
    test-name: 'shout hello'
    command: 'python3 shout.py'
    input: 'hello'
    expected-output: 'HELLO'
    comparison-method: 'exact'
    max-score: 2
Enter fullscreen mode Exit fullscreen mode

Each field has a counterpart in a request to OnlineCompiler.io's /api/run-tests/ endpoint:

Classroom test run-tests request
command compiler and code: you send the program's source, not a command
input tests[].input
expected-output tests[].expected_output
comparison-method: exact "checker": "exact", or "trim" (the default) to forgive trailing spaces
comparison-method: included or regex no direct match: write the full expected output, or use "tokens" to ignore spacing
timeout time_limit in seconds (2 by default, up to 30)
max-score tests[].weight, with "scoring": "weighted"
setup-command none: runs get the language's standard library, with no package installs

One request grades one submission

Three tests, worth 2, 3 and 5 points, the last one hidden:

curl -X POST https://api.onlinecompiler.io/api/run-tests/ \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "compiler": "python-3.14",
    "code": "print(input().upper())",
    "tests": [
      {"input": "hello\n", "expected_output": "HELLO\n", "weight": 2},
      {"input": "Hello, World\n", "expected_output": "HELLO, WORLD\n", "weight": 3},
      {"input": "ok\n", "expected_output": "OK\n", "weight": 5, "hidden": true}
    ],
    "checker": "exact",
    "scoring": "weighted"
  }'
Enter fullscreen mode Exit fullscreen mode

A correct program gets every test and a score of 100 (shortened):

{
  "verdict": "accepted",
  "score": 100.0,
  "passed": 3,
  "total": 3,
  "tests": [
    {"verdict": "accepted", "hidden": false, "output": "HELLO\n", "...": "..."},
    {"verdict": "accepted", "hidden": false, "output": "HELLO, WORLD\n", "...": "..."},
    {"verdict": "accepted", "hidden": true}
  ],
  "summary": "2 of 2 sample tests passed. 1 of 1 hidden test passed."
}
Enter fullscreen mode Exit fullscreen mode

A student who wrote print(input().title()) fails all three. The visible tests show what the program printed; the hidden one shows only its verdict, never its input or expected output:

{
  "verdict": "wrong_answer",
  "score": 0.0,
  "passed": 0,
  "total": 3,
  "tests": [
    {"verdict": "wrong_answer", "hidden": false, "output": "Hello\n", "...": "..."},
    {"verdict": "wrong_answer", "hidden": false, "output": "Hello, World\n", "...": "..."},
    {"verdict": "wrong_answer", "hidden": true}
  ],
  "summary": "0 of 2 sample tests passed. Sample 1 expected HELLO but the program printed Hello. 0 of 1 hidden test passed."
}
Enter fullscreen mode Exit fullscreen mode

With weighted scoring the score is 100 times the weight of the passed tests over the total weight. A program that only gets the first test right scores 20.

The same request works for any of the 46 languages: change compiler (g++-15, openjdk-25, gcc-15, and so on) and send that language's source.

Grading a whole class into a CSV

Put each student's file in a submissions folder, named after an opaque student id rather than a name, and run this:

import csv
import pathlib
import time

import requests

API = "https://api.onlinecompiler.io/api/run-tests/"
KEY = "YOUR_API_KEY"
TESTS = [
    {"input": "hello\n", "expected_output": "HELLO\n", "weight": 2},
    {"input": "Hello, World\n", "expected_output": "HELLO, WORLD\n", "weight": 3},
    {"input": "ok\n", "expected_output": "OK\n", "weight": 5, "hidden": True},
]


def grade(code):
    while True:
        reply = requests.post(API, headers={"Authorization": KEY}, timeout=120, json={
            "compiler": "python-3.14",
            "code": code,
            "tests": TESTS,
            "checker": "exact",
            "scoring": "weighted",
        })
        if reply.status_code != 429:  # 429: over the per-minute limit, so wait and retry
            reply.raise_for_status()
            return reply.json()
        time.sleep(30)


with open("grades.csv", "w", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(["student", "score", "verdict", "summary"])
    for path in sorted(pathlib.Path("submissions").glob("*.py")):
        result = grade(path.read_text())
        writer.writerow([path.stem, result["score"], result["verdict"], result["summary"]])
        print(path.stem, result["score"])
Enter fullscreen mode Exit fullscreen mode

With three submissions (one correct, one using title(), one that only handles the first test) it prints:

s1001 100.0
s1002 0.0
s1003 20.0
Enter fullscreen mode Exit fullscreen mode

and grades.csv holds the score, the verdict and the one-line summary for each student, ready to paste into a gradebook.

Each test counts as one run. A class of 120 with three tests is 360 runs, well inside the Free plan's 100,000 a month. Free accounts start at most 60 runs a minute, which is why the script waits on a 429; for big classes the API also takes "async": true and sends each result to a signed webhook.

Keeping hidden tests off your own machine

With run-tests, the grading script holds the tests and sends them every time. If you would rather keep them on the server, create a stored problem once (a statement, starter code, a reference solution and the tests, hidden ones included) and publish it. Publishing judges the reference solution against the tests first, so a typo in an expected output is caught before a student meets it. From then on a submission names the problem and sends only the code:

curl -X POST https://api.onlinecompiler.io/api/problems/shout/submissions/ \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"compiler": "python-3.14", "code": "print(input().upper())", "external_ref": "s1001"}'
Enter fullscreen mode Exit fullscreen mode

The guide has the full problem file and the create and publish calls.

How students hand in their work

Three ways, and all of them keep your API key away from students:

  • Your own page or LMS. Students paste or upload code into a course site you control; your server sends it to the API and records the score.
  • An embedded editor. The editor widget has a problem mode: the student sees the statement, the starter code and the visible tests, presses Judge to try them, and submits a limited number of times. Your server creates a short-lived session for each student, so the page never holds your key.
  • Keep the repositories. The classroom-autograder template on GitHub grades each push with a GitHub Actions workflow and puts the score in the job summary; its teacher script grades a whole class into a CSV. It is the closest to how Classroom worked. The trade-off: the key is a repository secret, and a student who edits the workflow could misuse it, so give each class its own key and disable it after the term.

What doesn't carry over

Being honest about the gaps, since a grading API is only one piece of what Classroom did:

  • Rosters, deadlines and the gradebook. Your LMS or course site keeps those. The API returns a score; where it goes is up to you.
  • Build steps. There is no make or mvn step. pytest, Jest, JUnit, xUnit and NUnit suites do run, with each test reported by name, but the build itself doesn't.
  • Substring and regex comparison. No included or regex checker.
  • Plagiarism checks. None.

If the repository workflow is what you liked about Classroom, look at Classroom 50 (free and open source, keeps grading in GitHub Actions in your own organization) or Codio (a full hosted platform); GitHub's migration page names both. If your assignments are programs that read input and print output, those tests move over unchanged.

The full guide, with the stored problem file, the widget session code and a comparison of the alternatives, is here: How to keep auto-grading programming assignments now that GitHub Classroom has closed.

Top comments (0)