Skip to main content

A general-purpose autograder written primarily in Python 3.

Project description

lograder

A Python library for building programming assignment autograders. The central abstraction is a Pipeline of Step instances -- each step validates input, runs a process, and passes results forward.

Input -> Check -> Mixin -> Build -> Test

Installation

pip install lograder
# or for development:
pip install -e ".[dev]"

Minimal example

from pathlib import Path
from lograder.pipeline.config import config
from lograder.pipeline.input.local_directory import LocalDirectory
from lograder.pipeline.check.project.simple_project import CMakeManifestCheck
from lograder.pipeline.build.cmake import CMakeBuild
from lograder.pipeline.test.output_compare import OutputCompareTest, OutputCompareCase
from lograder.pipeline.score import TestCaseScorer, AllOrNothingScorer, GradescopeConfig
from lograder.pipeline.pipeline import Pipeline

# Define test cases
cases = [
    OutputCompareCase(name="hello", args=[], expected_stdout="Hello, World!\n"),
    OutputCompareCase(name="echo",  args=["foo"], expected_stdout="foo\n"),
]

# Build the pipeline
pipeline = Pipeline()
pipeline.add(inp   := LocalDirectory())
pipeline.add(check := CMakeManifestCheck())
pipeline.add(build := CMakeBuild())
pipeline.add(tests := OutputCompareTest("hello", cases))

# Attach scorers
build.scorer = AllOrNothingScorer(10.0, label="Build")
tests.scorer = TestCaseScorer({"hello": 40.0, "echo": 50.0}, label="Correctness")

# Run
with config(root_directory=Path("/autograder/submission")):
    score = pipeline()

score.write_results_json(config=GradescopeConfig(visibility="visible"))

Documentation

Doc Contents
Getting started First autograder in 5 minutes
Concepts Pipeline, Step, Result, Manifest, Artifact
Input LocalDirectory, EnvironmentConfig
Check Manifest checks, SourceCheck, constraints
Build CMakeBuild, MakefileBuild, BashScriptBuild, PrebuiltArtifacts
Test All 9 test step types with full examples
Scoring Scorers, Gradescope output, results.json
Process layer TypedExecutable, CLIArgs, registry
Output / layouts Logging, HTML report, custom layouts
Examples Complete worked autograders

Design principles

  • Errors as values. Steps return Result[Ok, Err] rather than raising. A fatal Err return stops the pipeline; a yielded Err is logged and execution continues.
  • Typed data flow. Each step declares its input and output types. pipeline.validate_step_types() catches mismatches before the first submission runs.
  • No magic. Every process invocation goes through a TypedExecutable with validated CLIArgs. You can see exactly what command was run and what it produced.
  • Library only. lograder has no CLI and no service. You write a Python script; lograder is a collection of reusable building blocks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lograder-0.3.1.tar.gz (109.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lograder-0.3.1-py3-none-any.whl (166.1 kB view details)

Uploaded Python 3

File details

Details for the file lograder-0.3.1.tar.gz.

File metadata

  • Download URL: lograder-0.3.1.tar.gz
  • Upload date:
  • Size: 109.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for lograder-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d95f1cbf723008decfd165e030b31de4adb70c9d09cb811869e57b6108170b9c
MD5 cab8a00cb3bd8129c256d48e697edcb4
BLAKE2b-256 649882ea4d4b5aba4feacf97b4521b2117e1827ab5eb779901451c213bed4dc2

See more details on using hashes here.

File details

Details for the file lograder-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: lograder-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 166.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for lograder-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44a570a6f0fb8de716f539050fc537afc30ca84253c692c4c22d6e51a7468136
MD5 2d35308bc880b5edd412b7f4d75d407e
BLAKE2b-256 2f65c9161d80806ad766d5683b23338409fa5f9e5c970dd1be66a17b7e51b0e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page