-
Notifications
You must be signed in to change notification settings - Fork 8
Examples
Real-world usage examples for PCART.
Examples 1 and 2 correspond to projects and configuration files shipped in this repository. Examples 3–5 are illustrative templates; create or adapt the named JSON files before running them.
Upgrading SciPy from version 0.19.1 to 1.0.0 for a graph kernel project.
Deep-Graph-Kernels/
├── Kronecker_Generator.py # Main entry file
└── ... (other source files)
{
"projPath": "Example/Deep-Graph-Kernels",
"runCommand": "python Kronecker_Generator.py",
"runFilePath": "",
"libName": "scipy",
"currentVersion": "0.19.1",
"targetVersion": "1.0.0",
"currentEnv": "/home/user/anaconda3/envs/scipy0.19.1",
"targetEnv": "/home/user/anaconda3/envs/scipy1.0.0"
}python main.py -cfg Deep-Graph-Kernels.jsonIn a retained single-project run, PCART reported 21 discovered and covered SciPy callsites: 20 compatible and 1 incompatible callsite that was successfully repaired. Exact totals depend on the checkout and the code paths exercised by runCommand; distinguish the report's total discovered count from its covered count.
Upgrading aiofiles from version 22.1.0 to 23.1.0 for an async project.
async_await_invocation/aiofiles1/
├── test_asyncawait.py # Main entry file
└── ... (other source files)
{
"projPath": "Example/async_await_invocation/aiofiles1",
"runCommand": "python test_asyncawait.py",
"runFilePath": "",
"libName": "aiofiles",
"currentVersion": "22.1.0",
"targetVersion": "23.1.0",
"currentEnv": "/home/user/anaconda3/envs/aiofiles22.1.0",
"targetEnv": "/home/user/anaconda3/envs/aiofiles23.1.0"
}python main.py -cfg aiofiles1.jsonUpgrading PyTorch from version 1.7.1 to 1.9.0 for a deep learning project.
{
"projPath": "/home/user/mytorch_project",
"runCommand": "python train.py",
"runFilePath": "src",
"libName": "torch",
"currentVersion": "1.7.1",
"targetVersion": "1.9.0",
"currentEnv": "/home/user/anaconda3/envs/torch1.7.1",
"targetEnv": "/home/user/anaconda3/envs/torch1.9.0"
}-
runFilePath: "src"because the entry file is in thesrc/subdirectory - PyTorch may require GPU-enabled environments for full testing
Upgrading Flask from version 2.0 to 3.0 for a web application.
{
"projPath": "/home/user/flask_app",
"runCommand": "python app.py",
"runFilePath": "",
"libName": "flask",
"currentVersion": "2.0.0",
"targetVersion": "3.0.0",
"currentEnv": "/home/user/venv/flask2.0",
"targetEnv": "/home/user/venv/flask3.0"
}Upgrading NumPy from version 1.20 to 1.24 for a data processing project.
{
"projPath": "/home/user/data_project",
"runCommand": "python process.py",
"runFilePath": "",
"libName": "numpy",
"currentVersion": "1.20.0",
"targetVersion": "1.24.0",
"currentEnv": "/home/user/venv/numpy1.20",
"targetEnv": "/home/user/venv/numpy1.24"
}PCART can work with Python libraries whose calls can be discovered and whose API definitions are already available or can be extracted. Dynamic results also depend on runtime coverage, importability, and signature introspection. Common examples include:
| Library | libName | Example Configurations |
|---|---|---|
| PyTorch | torch |
torch_DataLoader_local.json; adapt paths for your machine |
| NumPy | numpy |
(create your own) |
| SciPy | scipy |
Deep-Graph-Kernels.json |
| Pillow | PIL |
(create your own) |
| aiofiles | aiofiles |
aiofiles1.json |
| Flask | flask |
flask1.json, flask2.json |
| Click | click |
click1.json, click2.json, click3.json |
| TensorFlow | tensorflow |
tensorflow1.json, tensorflow2.json |
- Determine current and target versions of your library
- Create virtual environments with both versions
- Create a JSON configuration file in
Configure/or pass an absolute/existing relative path to eithermain.pyorextractLibAPI.py - Run PCART
For more examples, see PCBench - a large-scale benchmark with 47,478 test cases covering 844 parameter-changed APIs from 33 popular Python third-party libraries.
See Configuration-Guide for detailed field descriptions.
- Quick-Start: Basic usage tutorial
- Configuration-Guide: Configuration reference
- Troubleshooting: Common issues and solutions