This module provides a grader for c++ programs.
Project description
PyComGrader: A Python Package for Grading C++ Programs
Table of Contents
Introduction
PyComGrader is a Python package designed to help educators and students easily evaluate and grade C++ programs against multiple test cases. It provides a simple and efficient way to test programs against multiple test cases and can be used on multiple platforms, including Windows and Linux. The package can be used as a command-line tool and provides various options to customize the grading process. PyComGrader aims to simplify the process of setting up training contests offline, testing problems against multiple test cases during a contest to get preliminary results, and helping prepare and form competitive programmers. However, please note that this package is not intended for official contests and is solely meant as an educational tool.
Features
- Grade C++ programs against multiple test cases
- Command-line interface for easy usage
- Customizable time and memory limits
- Detailed status messages for each test case
- Cross-platform support (Windows and Linux)
Installation
To install PyComGrader, use pip:
pip install pycomgrader
Prerequisites
Before using PyComGrader, ensure that you have g++ installed and accessible in your system's PATH. PyComGrader relies on g++ to compile C++ programs before grading them. You can install g++ using your system's package manager. For example, on Ubuntu, you can install it with:
sudo apt-get install g++
On Windows, you can install g++ as part of MinGW or through other means.
Usage
Getting Started
To start using PyComGrader, follow these steps:
- Install PyComGrader by running
pip install pycomgraderin your terminal. - Import the necessary modules:
from pycomgrader import Grader. - Create a
Graderobject with the file to test, time limit, and memory limit:grader = Grader(2000, 128, exec_file = 'my_program') - Create a corresponding directory for the test cases, and place the input files (with the extension
.in) and expected output files (with the extension.out) inside. The filenames for the input and output files can be arbitrary, but they must have the same name. For example, you can have 01.in, 01.out, 02.in, 02.out, etc. - Test the program against one or more test cases using the
grader.grade('test_cases_dir')method.
Command Line Interface
PyComGrader can be used as a command-line tool by running pycomgrader followed by the path to the file to test and the directory with the test cases. For example:
$ pycomgrader my_program.cpp test_cases_dir
You can specify the time limit (milliseconds) and memory limit (megabytes) as positional arguments respectively:
$ pycomgrader my_program.cpp test_cases_dir 1000 32
One of the key features of PyComGrader is its ability to execute C++ programs directly, without the need for a separate compiler. This makes it easy to use on systems where a C++ compiler is not installed, or where the user has other means of compiling their source code. Users can use the -e flag when running PyComGrader to indicate that a file should be executed directly.
$ pycomgrader my_program test_cases_dir -e
This will tell PyComGrader to execute the contents of my_program directly, rather than compiling it first.
For detailed usage information, run:
$ pycomgrader --help
License
PyComGrader is released under the MIT License. See LICENSE for details.
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycomgrader-1.2.0.tar.gz.
File metadata
- Download URL: pycomgrader-1.2.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e0e1a9227a1e1adf66f84cfed52940387b7a6497eaa3ffbcb09764bf000f838
|
|
| MD5 |
7345f0db53f81d74510e32dad05842ea
|
|
| BLAKE2b-256 |
c35e93534b586d095969ff52f8f9272390ea6bb7346a94c67c213b57206cc242
|
Provenance
The following attestation bundles were made for pycomgrader-1.2.0.tar.gz:
Publisher:
publish.yml on ajhglez99/pycomgrader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycomgrader-1.2.0.tar.gz -
Subject digest:
1e0e1a9227a1e1adf66f84cfed52940387b7a6497eaa3ffbcb09764bf000f838 - Sigstore transparency entry: 162125852
- Sigstore integration time:
-
Permalink:
ajhglez99/pycomgrader@b7b68b998a2b285d007079f6560944d3e7711add -
Branch / Tag:
refs/tags/v1.2.0-alpha - Owner: https://github.com/ajhglez99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b7b68b998a2b285d007079f6560944d3e7711add -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycomgrader-1.2.0-py3-none-any.whl.
File metadata
- Download URL: pycomgrader-1.2.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
070b7d47b0d295457b70a9c9dda30446b1585add7888217dcb632c06a992d138
|
|
| MD5 |
297293bd22ce1f17447f8aadeef4cb12
|
|
| BLAKE2b-256 |
083a738acb9a771eba44c157d10b14371b5924d890a8d00302b0997cc3d97e61
|
Provenance
The following attestation bundles were made for pycomgrader-1.2.0-py3-none-any.whl:
Publisher:
publish.yml on ajhglez99/pycomgrader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycomgrader-1.2.0-py3-none-any.whl -
Subject digest:
070b7d47b0d295457b70a9c9dda30446b1585add7888217dcb632c06a992d138 - Sigstore transparency entry: 162125853
- Sigstore integration time:
-
Permalink:
ajhglez99/pycomgrader@b7b68b998a2b285d007079f6560944d3e7711add -
Branch / Tag:
refs/tags/v1.2.0-alpha - Owner: https://github.com/ajhglez99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b7b68b998a2b285d007079f6560944d3e7711add -
Trigger Event:
release
-
Statement type: