Given source code, Makefile (or build commands), input files, and answer files then judge the program locally.
Project description
Local Judge
Given source code, Makefile (or build commands), input files, and answer files then judge the program locally.
NOTE: this package is not an "online judge" (UVa, LeetCode, etc.) that allows you to solve some algorithmic problems but a tool that can judge (or correct) the students' compiler assignments (included but not limited to) by themselves and by the teaching assistants. You can still use this package to help simulate "online judge", which is not the goal of this work.
Workflow
Screenshot
Installation
-
For global usage:
$ pip install local-judge
-
With virtualenv:
$ virtualenv -p python3.6 venv $ source venv/bin/activate $ pip install local-judge
Features
- Both
- Automatically build the source code into executable
- Automatically run the executable for each input and compare output with answer
- Customization friendly
- Able to leverage git diff tool to compare the result with the answer
- Student (
judge
)- Without any dependencies but standard build-in python packages
- TA (
ta_judge
)- Two dependencies packages:
openpyxl
,rarfile
- Support different zip type (
.zip
,.rar
) - When error is occurred, not interrupt or exit but just log it
- Output to excel table
- Multiprocessing
- Two dependencies packages:
Environment (Recommended)
- Ubuntu 18.04
- python 3.6
- git 2.17.1 (Our default diff tool for comparing between output and answer is git. Please make sure that you have installed it.)
Usage Examples
Documentation of Configuration
judge
judge.conf
: be placed in the root of your program [example]BuildCommand
: how to build the executableExecutable
: the name of the executableRunCommand
: how to run the executable with input and outputInputs
: input files (can use wildcard)TempOutputDir
: the temporary directory to place output filesDiffCommand
: how to find differences between output and answerDeleteTempOutput
: whether to delete the temporary output after finding the differences (true or false)AnswerDir
: the directory where contains the answer files corresponding to the input filesAnswerExtension
: the extension of the answer filesExitOrLog
: exit when any error occurred or just log the errorScoreDict
: the dictionary for the mapping of correctness and scoreTotalScore
: used if the number of tests is more thanScoreDict
Timeout
: execution timeout for each test case
ta_judge
ta_judge.config
: [example]- First part is
judge.conf
StudentList
: the execl file which contains student name and idStudentsZipContainer
: the directory where contains students' submit homeworksStudentsPattern
: used to match zip filesUpdateStudentPattern
: used for update score of single studentStudentsExtractDir
: the directory where contains extracted homeworksScoreOutput
: the output excel fileExtractAfresh
: true: re-extract zipped file for each judge time; false: use pre-extracted files (underStudentsExtractDir
) to judge
- First part is
Contributing
Please make sure that you have installed pre-commit for linting the code with the black style.
Development
Environment
$ virtualenv -p python3.7 venv3.7
$ source venv3.7/bin/activate
$ python setup.py develop
$ pip install -e .
$ pip list
Package Version Location
------------------ ------- ---------------------------------
black 21.12b0
click 8.0.3
et-xmlfile 1.1.0
importlib-metadata 4.10.0
local-judge 2.4.7 /home/ben/pro/selfpro/local-judge
mypy-extensions 0.4.3
openpyxl 3.0.9
pathspec 0.9.0
pip 21.0.1
platformdirs 2.4.1
rarfile 4.0
setuptools 54.1.1
tomli 1.2.3
typed-ast 1.5.1
typing-extensions 4.0.1
wheel 0.36.2
zipp 3.6.0
Run the test locally
$ python -m pytest tests/test_cli.py
License
MIT
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
Built Distribution
File details
Details for the file local-judge-2.7.2.tar.gz
.
File metadata
- Download URL: local-judge-2.7.2.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3260dcdf965d6be7ea7b23388c93541f5ce04c261e6db027ffc4019b4ba890b8 |
|
MD5 | 1455629784ddfe19290a4e909766c33e |
|
BLAKE2b-256 | 5355ff515f0a02aa2b04a6ed9d85aa0ef44cb83dcdd3b546d90e36f56718da4e |
File details
Details for the file local_judge-2.7.2-py3-none-any.whl
.
File metadata
- Download URL: local_judge-2.7.2-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b3403b433c880bb9e09c5420a0e28d2f7dc16628dbd97034a67c7faade5dda9 |
|
MD5 | 205c04c2ea3a9303f7724770fb399538 |
|
BLAKE2b-256 | 34a3fa673086fa02663f7d7024ccd4e39a79b38c2a49ffe6379f3010b2a010d8 |