Skip to content

Examples

PCART Bot edited this page Apr 23, 2026 · 2 revisions

Examples

Real-world usage examples for PCART.

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": "/home/user/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

  • Total APIs analyzed: 21
  • Compatible APIs: 20
  • Incompatible APIs: 1 (successfully repaired)

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": "/home/user/async_project",
    "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

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

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

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 works with any Python library. Common examples:

Library libName Example Configurations
PyTorch torch pytorch_upgrade.json
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/ directory
  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