Utilities for Competitive Programming.
Features:
- Download samples from kattis, aceptaelreto, adventofcode.
- Test in c, cpp, python, java, rust, ruby, bash, nim.
- Submit to kattis.
- Interactive CLI menu.
Tests only for complete textual match, ignoring leading and trailing whistespaces.
Assuming you have a Python3 distribution with pip, install the package running:
pip3 install cputils
Typically you'll want to work on a dedicated repo/folder for your task (solving the problems in a server, preparing problems...). You should first create a configuration file defining how cputils will work on that repo/folder and then use the CLI or the commands to work in it.
To create a config file, run
cpconfig
To download the samples of a problem run
cpsamples <problem>
To test a solution or set of solutions run
cptest <problem>/<solution(s)>
Pro-tip: you can use glob patterns like problem/code*
or problem/*.py
.
To submit a solution (only kattis)
cpsubmit <problem>/<solution(s)>
To run an interactive CLI
cpmenu
Yo can also provide the problem and language with the arguments, or change it in the menu. See help (h) for more info.
Testing requires installing the test extra. Furthermore, some tests require the languages to be installed and available.
To run all tests:
make test
To run a single test module:
pytest tests/test_<test_name>.py