pycomgrader


Namepycomgrader JSON
Version 1.0.1 PyPI version JSON
download
home_page
Summarythis module provides a grader for c++ programs.
upload_time2024-02-17 05:15:39
maintainer
docs_urlNone
authorAnibal Hernández
requires_python>=3.7
licenseMIT License Copyright (c) 2024 ajhglez99 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords competitive programming educational grader c++
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
             PyComGrader: A Python Module for Grading C++ Programs
=====================================================

Introduction
------------

PyComGrader is a Python module 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 module 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 module is not intended for official contests and is solely meant as an educational tool.

Features
--------

The following features are included in PyComGrader:

* Initialize a `Grade` class with a file to test, a time limit, and a memory limit.
* Automatic comparison of outputs: PyComGrader automatically compares the program's output to the expected output.
* Methods to test the given input against sets of test cases or individual tests.
* Support for both a command-line interface and Python API.
* Customizable test case directories and filenames.
* Optional support for g++ C++ compiler (recommended).
* Easy installation using `pip install pycomgrader`.

Getting Started
---------------

To start using PyComGrader, follow these steps:

1. Install PyComGrader by running `pip install pycomgrader` in your terminal.
2. Import the necessary modules: `from pycomgrader import Grader`.
3. Create a `Grader` object with the file to test, time limit, and memory limit: `grader = Grader(2000, 128, exec_file = 'my_program')`
4. 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.
5. 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:
```bash
$ pycomgrader my_program.cpp test_cases_dir
```
You can specify the time limit (milliseconds) and memory limit (megabytes) as positional arguments respectively:
```bash
$ 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.
```bash
$ pycomgrader my_program test_cases_dir -e
```
This will tell PyComGrader to execute the contents of `my_program.cpp` directly, rather than compiling it first.

Help
----

For detailed usage information, run `pycomgrader --help`:
```
offline grader for C++ programs

positional arguments:
  file              path to the program to submit
  dir               path to the directory containing the test cases
  time              maximum amount of time (in milliseconds) to run the program
  mem               maximum amount of memory (in megabytes) to allocate to the program

options:
  -h, --help        show this help message and exit
  -e, --executable  notifies the grader that the file is executable
```
Requirements
------------

PyComGrader requires the following packages to be installed:

* Psutil
* Rich
* PathType

Optional Dependencies
-----------------------

While not required, we recommend installing g++ C++ compiler to compile and run the tested programs.

Tips and Tricks
--------------

Here are some tips and tricks to help you get the most out of PyComGrader:

* Use descriptive names for your test cases, so you can easily identify what each test case is checking.
* Write comprehensive test cases to cover all aspects of the student's code.

Troubleshooting
---------------

If you encounter any issues while using PyComGrader, refer to the troubleshooting guide below:

* Q: My test cases are not being recognized. What do I do?

  A: Check that your test cases are named correctly (i.e., with the extension `.in` for inputs and `.out` for expected outputs).

* Q: PyComGrader is taking too long to run. What do I do?

  A: Try reducing the number of test cases you are running at once.

* Q: Does PyComGrader support other programming languages besides C++  
  
  A: While PyComGrader was originally designed for grading C++ programming assignments because it is a widely used language in the competitive programming community, it can be extended to support other programming languages. By modifying the code to recognize and run programs for the language you want to support, you can use PyComGrader to grade assignments written in other languages. The use of a virtual environment is recommended if this is the case.

* Q: PyComGrader is giving me a compile error. What do I do?
  
  A: Check if g++ is installed and accessible as a system command. You can do this by opening a terminal and running `g++ --version`. If g++ is not installed, you can install it using your operating system's package manager. If g++ is installed but not accessible, you may need to modify your system's PATH environment variable to include the directory where g++ is installed.

License
-------

PyComGrader is released under the MIT License. See LICENSE for details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pycomgrader",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "competitive programming,educational,grader,c++",
    "author": "Anibal Hern\u00e1ndez",
    "author_email": "",
    "download_url": "",
    "platform": null,
    "description": " PyComGrader: A Python Module for Grading C++ Programs\n=====================================================\n\nIntroduction\n------------\n\nPyComGrader is a Python module 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 module 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 module is not intended for official contests and is solely meant as an educational tool.\n\nFeatures\n--------\n\nThe following features are included in PyComGrader:\n\n* Initialize a `Grade` class with a file to test, a time limit, and a memory limit.\n* Automatic comparison of outputs: PyComGrader automatically compares the program's output to the expected output.\n* Methods to test the given input against sets of test cases or individual tests.\n* Support for both a command-line interface and Python API.\n* Customizable test case directories and filenames.\n* Optional support for g++ C++ compiler (recommended).\n* Easy installation using `pip install pycomgrader`.\n\nGetting Started\n---------------\n\nTo start using PyComGrader, follow these steps:\n\n1. Install PyComGrader by running `pip install pycomgrader` in your terminal.\n2. Import the necessary modules: `from pycomgrader import Grader`.\n3. Create a `Grader` object with the file to test, time limit, and memory limit: `grader = Grader(2000, 128, exec_file = 'my_program')`\n4. 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.\n5. Test the program against one or more test cases using the `grader.grade('test_cases_dir')` method.\n\nCommand Line Interface\n----------------------\n\nPyComGrader 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:\n```bash\n$ pycomgrader my_program.cpp test_cases_dir\n```\nYou can specify the time limit (milliseconds) and memory limit (megabytes) as positional arguments respectively:\n```bash\n$ pycomgrader my_program.cpp test_cases_dir 1000 32\n```\nOne 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.\n```bash\n$ pycomgrader my_program test_cases_dir -e\n```\nThis will tell PyComGrader to execute the contents of `my_program.cpp` directly, rather than compiling it first.\n\nHelp\n----\n\nFor detailed usage information, run `pycomgrader --help`:\n```\noffline grader for C++ programs\n\npositional arguments:\n  file              path to the program to submit\n  dir               path to the directory containing the test cases\n  time              maximum amount of time (in milliseconds) to run the program\n  mem               maximum amount of memory (in megabytes) to allocate to the program\n\noptions:\n  -h, --help        show this help message and exit\n  -e, --executable  notifies the grader that the file is executable\n```\nRequirements\n------------\n\nPyComGrader requires the following packages to be installed:\n\n* Psutil\n* Rich\n* PathType\n\nOptional Dependencies\n-----------------------\n\nWhile not required, we recommend installing g++ C++ compiler to compile and run the tested programs.\n\nTips and Tricks\n--------------\n\nHere are some tips and tricks to help you get the most out of PyComGrader:\n\n* Use descriptive names for your test cases, so you can easily identify what each test case is checking.\n* Write comprehensive test cases to cover all aspects of the student's code.\n\nTroubleshooting\n---------------\n\nIf you encounter any issues while using PyComGrader, refer to the troubleshooting guide below:\n\n* Q: My test cases are not being recognized. What do I do?\n\n  A: Check that your test cases are named correctly (i.e., with the extension `.in` for inputs and `.out` for expected outputs).\n\n* Q: PyComGrader is taking too long to run. What do I do?\n\n  A: Try reducing the number of test cases you are running at once.\n\n* Q: Does PyComGrader support other programming languages besides C++  \n  \n  A: While PyComGrader was originally designed for grading C++ programming assignments because it is a widely used language in the competitive programming community, it can be extended to support other programming languages. By modifying the code to recognize and run programs for the language you want to support, you can use PyComGrader to grade assignments written in other languages. The use of a virtual environment is recommended if this is the case.\n\n* Q: PyComGrader is giving me a compile error. What do I do?\n  \n  A: Check if g++ is installed and accessible as a system command. You can do this by opening a terminal and running `g++ --version`. If g++ is not installed, you can install it using your operating system's package manager. If g++ is installed but not accessible, you may need to modify your system's PATH environment variable to include the directory where g++ is installed.\n\nLicense\n-------\n\nPyComGrader is released under the MIT License. See LICENSE for details.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 ajhglez99  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "this module provides a grader for c++ programs.",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/ajhglez99/PyComGrader"
    },
    "split_keywords": [
        "competitive programming",
        "educational",
        "grader",
        "c++"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fdf6d32d2668e5947d215319eb5059dd9b876e10f0268a0563385f65d28cd7eb",
                "md5": "372e6b52de2d90d7febe8c3b19d8464c",
                "sha256": "f0b02234d9986edd73cc9e81e821ab9bd2401472e5f20bee3c87e50373679360"
            },
            "downloads": -1,
            "filename": "pycomgrader-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "372e6b52de2d90d7febe8c3b19d8464c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9466,
            "upload_time": "2024-02-17T05:15:39",
            "upload_time_iso_8601": "2024-02-17T05:15:39.453411Z",
            "url": "https://files.pythonhosted.org/packages/fd/f6/d32d2668e5947d215319eb5059dd9b876e10f0268a0563385f65d28cd7eb/pycomgrader-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-17 05:15:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ajhglez99",
    "github_project": "PyComGrader",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pycomgrader"
}
        
Elapsed time: 0.18520s