Project parser for Python
Project description
kaprese
Collection of APR tools by SAL (Software Analysis Lab) at Korea University.
Quick Start
You can run kaprese by following the steps below.
Prerequisites
kaprese requires the following software to be installed:
- Python 3.12 or higher (required)
- Docker 24 or higher (recommended, we did not test it on other versions)
Installation
kaprese can be installed via pip:
pip install kaprese
Usage
You can run saver engine on flint-1 benchmark as follows:
kaprese benchmark preset c
kaprese engine preset saver
kaprese run -b flint-1 spearmint-1 -e saver
# See the logs. If you want to see more logs set LOG_LEVEL environment variable to INFO, e.g.,
# LOG_LEVEL=info kaprese run -b flint-1 spearmint-1 -e saver
Options
kaprese provides the following options:
| Benchmarks | Repository |
|---|---|
benchmark |
command to do something about benchmark |
engine |
command to do something about engine |
run |
command to run APR tools on benchmarks |
eval |
command to evaluate the results |
-h, --help |
command to show help |
Benchmarks and Engines
kaprese provides a set of benchmarks and engines.
You can register them by calling kaprese benchmark preset <language> and kaprese engine preset <engine>.
The following table shows the list of supported benchmarks and engines.
Benchmarks
| Benchmarks | Repository |
|---|---|
c |
C benchmarks in kupl/starlab-benchmarks |
ocaml |
OCaml benchmarks in kupl/starlab-benchmarks |
Engines
| Engines | Repository |
|---|---|
saver |
kupl/SAVER_public |
cafe |
kupl/LearnML |
How to Add Your Own
All benchmarks and engines are registered to the global registry (by default, registry is located in ~/.kaprese).
You can add your own benchmarks and engines by registering them with a small python code.
Add a Benchmark
A benchmark is an instance of kaprese.core.benchmark.Benchmark.
You can initialize a benchmark with the following 4 parameters:
name: name of the benchmark (must be unique).image: docker image name, e.g.,ghcr.io/kupl/starlab-benchmarks/c:flint-1.language_commandor_language: command to find the language of the benchmark, if you set_language,language_commandis ignored. the command will be run inside the docker container fromimage.workdir_commandor_workdir: command to find the working directory of the benchmark, if you set_workdir,workdir_commandis ignored. the command will be run inside the docker container fromimage. Then by callingregistermethod ofBenchmark, you can register the benchmark to the global registry.
For example, the following code defines a benchmark named flint-1:
from kaprese.core.benchmark import Benchmark
flint_1 = Benchmark(
name="flint-1",
image="ghcr.io/kupl/starlab-benchmarks/c:flint-1",
language_command="cat metadata.json | jq -r .language", # c
workdir_command="cd $(cat metadata.json | jq -r .buggyPath) && pwd", # /workspace/buggy
)
flint_1.register()
Add an Engine
An engine is an instance of kaprese.core.engine.Engine.
You can initialize an engine with the following 6 parameters:
name: name of the engine (must be unique).supported_languages: list of supported languages, e.g.,["c", "java"].supported_os: list of supported operating systems, e.g.,["ubuntu:20.04", "debian:12"].location: location to the docker context directory of the engine, e.g.,~/saver.build_args: arguments to pass todocker buildcommand to fillARGvariables in the Dockerfile, e.g.,{"SOME_ARG": "some_value"}.exec_commands: list of commands to execute the engine, e.g.,["saver ...", "cp ..."], all commands are joined with;, in other words, all commands are executed and the return code of the last command is returned. Note that, your dockerfile MUST gets the benchmark image as an argument and starts build from it, e.g.,
ARG BENCHMARK_IMAGE
FROM ${BENCHMARK_IMAGE}
...
In the same way, you MUST specify the benchmark image as an argument when you build the engine image, e.g.,
from kaprese.core.engine import Engine
saver = Engine(
"saver",
supported_languages=["c"],
supported_os=["ubuntu:20.04"],
location="https://github.com/kupl/kaprese-engines#main:context/saver/starlab-benchmarks", # location of saver context for preset benchmarks
build_args={"BENCHMARK_IMAGE": "ghcr.io/kupl/starlab-benchmarks/c:flint-1"},
exec_commands= ["saver ...", "cp ..."], # see kaprese/engines/saver.py
)
Then by calling register method of Engine, you can register the engine to the global registry.
saver.register()
How to Contribute
Any contributions are welcome! You can leave an issue or make a pull request.
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 kaprese-1.0.0.tar.gz.
File metadata
- Download URL: kaprese-1.0.0.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
035b63b7f6194422fa1c044305cb45699d168ce2057727d208e40a65fd3f6372
|
|
| MD5 |
b47cd7ec2639b90b811f03a9ca852a79
|
|
| BLAKE2b-256 |
46e7a684659deea250eba6e3b28a7c34068493a165057beb28e8d2f7ae697c60
|
Provenance
The following attestation bundles were made for kaprese-1.0.0.tar.gz:
Publisher:
release.yml on kupl/kaprese
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kaprese-1.0.0.tar.gz -
Subject digest:
035b63b7f6194422fa1c044305cb45699d168ce2057727d208e40a65fd3f6372 - Sigstore transparency entry: 643240232
- Sigstore integration time:
-
Permalink:
kupl/kaprese@d590119a5d14fd0ca8d6ae678e991a58d84f9b7d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/kupl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d590119a5d14fd0ca8d6ae678e991a58d84f9b7d -
Trigger Event:
release
-
Statement type:
File details
Details for the file kaprese-1.0.0-py3-none-any.whl.
File metadata
- Download URL: kaprese-1.0.0-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf21f7cb6196d48e3b55d079b4f99f3f6c6fbe9d0504802609f399fd75ece60c
|
|
| MD5 |
1994618b155bb9989a6b66e02c8566a9
|
|
| BLAKE2b-256 |
b95a86f5e4864fc323f78327a6e89f53f0330cc38af8ba554720e83ce9476184
|
Provenance
The following attestation bundles were made for kaprese-1.0.0-py3-none-any.whl:
Publisher:
release.yml on kupl/kaprese
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kaprese-1.0.0-py3-none-any.whl -
Subject digest:
cf21f7cb6196d48e3b55d079b4f99f3f6c6fbe9d0504802609f399fd75ece60c - Sigstore transparency entry: 643240258
- Sigstore integration time:
-
Permalink:
kupl/kaprese@d590119a5d14fd0ca8d6ae678e991a58d84f9b7d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/kupl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d590119a5d14fd0ca8d6ae678e991a58d84f9b7d -
Trigger Event:
release
-
Statement type: