Skip to content

Examples

PCART Bot edited this page Sep 15, 2026 · 3 revisions

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.

Example 1: SciPy Upgrade (Deep-Graph-Kernels)

Upgrading SciPy from version 0.19.1 to 1.0.0 for a graph kernel project.

Project Structure

Deep-Graph-Kernels/
├── Kronecker_Generator.py    # Main entry file
└── ... (other source files)

Configuration (Deep-Graph-Kernels.json)

{
    "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"
}

Run Command

python main.py -cfg Deep-Graph-Kernels.json

Expected Results

In 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.


Example 2: aiofiles Upgrade

Upgrading aiofiles from version 22.1.0 to 23.1.0 for an async project.

Project Structure

async_await_invocation/aiofiles1/
├── test_asyncawait.py    # Main entry file
└── ... (other source files)

Configuration (aiofiles1.json)

{
    "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"
}

Run Command

python main.py -cfg aiofiles1.json

Example 3: PyTorch Upgrade (Illustrative Template)

Upgrading PyTorch from version 1.7.1 to 1.9.0 for a deep learning project.

Configuration (pytorch_upgrade.json)

{
    "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"
}

Notes

  • runFilePath: "src" because the entry file is in the src/ subdirectory
  • PyTorch may require GPU-enabled environments for full testing

Example 4: Flask Upgrade (Illustrative Template)

Upgrading Flask from version 2.0 to 3.0 for a web application.

Configuration (flask_upgrade.json)

{
    "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"
}

Example 5: NumPy Upgrade (Illustrative Template)

Upgrading NumPy from version 1.20 to 1.24 for a data processing project.

Configuration (numpy_upgrade.json)

{
    "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"
}

Supported Libraries

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

Creating Your Own Configuration

  1. Determine current and target versions of your library
  2. Create virtual environments with both versions
  3. Create a JSON configuration file in Configure/ or pass an absolute/existing relative path to either main.py or extractLibAPI.py
  4. 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.

Related Pages