Students' solution checker
Project description
Manytask Checker
Script to test students' solutions with manytask integration
Key features:
- git changes detection
- extension for different languages
- sandbox execution
- manytask integration
Please refer to the manytask documentation first to understand the drill
How it works
The checker
lib is a relatively small cli script aiming to run tests in gitlab runner and push results to manytask
.
The full checker
and manytask
setup roughly looks as follows
- self-hosted
gitlab
instance - storing repos with assignments and students' repo- private repo - a repository with tasks, public and private tests, gold solutions, ect.
- public repo - a repository available to students with tasks and solution templates
- students' group - the group where
manytask
will create repositories for students
each students' repo - fork from public repo
gitlab runners
- place where students' solutions likely to be testedchecker
script - some script to test students' solutions and push scores/grades to themanytask
manytask
instance - web application managing students' grades (in google sheet) and deadlines (web page)
The flow for checking students' solution looks like:
- Student push his solution to a gitlab repo
- gitlab-ci runs separate docker in gitlab-runner
- gitlab-ci runs this script with some parameters
- the script detect the latest changes (via git) and select tasks to check
- the tasks forwarded to
tester
and it returns obtained scores - the script push student scores to the manytask
(additionally script can check ground-truth solutions, export new tasks etc)
Usage
Pre requirements
- manytask web app Currently, this lib is integrated with manytask only, so you need it to be set up first, see installation instructions in manytask repo.
- gitlab with access to greate groups, users and add runners
This pre-requirement for manytask; See manytask installation instructions for more info - Created and tested tester for your course/language
Preparations
Obtain service keys for this script to operate
- manytask tester token you set up when run it
- gitlab service user to operate with your repositories
(better to create a new one)
Create gitlab repositories layout
- Create private repository with tasks, public and private tests and ground-truth solution;
Choose one of the suitable layouts (see driver.py)
Grant access to your service account - Create public empty repository
Grant access to your service account - Create private (!) group for students repositories
(You have already done it if you set up manytask)
Grant access to your service account
Edit config files in repository
.course.yml
- main endpoints config
(see .course.yml example).deadlines.yml
- task deadlines (see .deadlines.yml example).gitlab-ci.yml
- set up gitlab ci pipeline to test students tasks.releaser-ci.yml
- set up gitlab ci pipeline to test new added tasks and build dockers
Setup dockers with env ready for testing, it's convenient to have 2 dockers:
base.docker
- base docker to build and test students solutions, install lib heretestenv.docker
- docker on top of base docker, to save tasks and tests
Structure
Course
-
CourseConfig
Manage course configuration. Wrapper around.course.yml
file. -
CourseSchedule
Manage course deadlines. Wrapper around.deadlines.yml
file. -
CourseDriver
Manage mapping of the Course to the Filesystem. (e.g. map Task to folders with tests and source files)
Available layouts are (see driver.py):flat
- all tasks in root folder of the repogroups
- each group has its own folder
Testing
-
Executor is object to run commands with some isolation level.
Available modes are:sandbox
- separate process (clean env variables, nouser/nogroup, disabled network)docker
- TODO
-
Tester is object which can test single task: copy files, build, test it, cleanup.
Tester is extendable for each course/language. Now available:python
Developing
Installation
Create venv
python -m venv .venv
source .venv/bin/activate
Install lib in dev mode
(.venv)$ pip install -U --editable .[test] # .\[test\] in zsh
Running tests and linters
pytest . --cpp --python
ruff checker
mypy checker
isort --check .
Adding a new language tester
In order to add a new language to the test system you need to make a pull request.
- Add a new tester in checker/testers
(see python.py as example) - Update tester.py
create
method to run your tester - Write tests for a new tester in ./tests/testers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file manytask_checker-0.9.2-py3-none-any.whl
.
File metadata
- Download URL: manytask_checker-0.9.2-py3-none-any.whl
- Upload date:
- Size: 47.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9009e3d13fc38401f1f9a51171c424087db995ff42ec9cbd44e0d762df289e0 |
|
MD5 | 5794af8e464b3936f1fac6317cad4ff8 |
|
BLAKE2b-256 | a22eb4d2734f98c4af5f2d11d036eb60966e091665deb0121d82863452a0a0a6 |