Skip to content

Quick Start

PCART Bot edited this page May 11, 2026 · 5 revisions

Quick Start Guide

Get started with PCART in 5 minutes.

Prerequisites

PCART Runtime Environment

  • Linux (Ubuntu 18.04.1+) or Windows 11
  • Python 3.9+
  • dill 0.3.7

Target Project Environments

  • Python 3.x
  • dill 0.3.7
  • The library you want to upgrade (at current and target versions)
  • Project’s requirements.txt

Step 1: Prepare Virtual Environments

Create two virtual environments for your target project:

# Create environments with current and target versions
conda create -n myproject_v1 python=3.x
conda create -n myproject_v2 python=3.x

# Activate current version environment
conda activate myproject_v1
pip install dill
pip install your-library==1.7.1

# Activate target version environment
conda deactivate
conda activate myproject_v2
pip install dill
pip install your-library==1.9.0

Step 2: Create Configuration File

Create a JSON file in the Configure/ directory. The runCommand field supports multiple formats:

  • python run.py — standard Python script
  • python3 src/main.py — Linux python3
  • py -3.9 train.py — Windows py launcher
  • pytest tests/ or python -m pytest tests/ — console scripts / module execution

PCART auto-detects the Python executable from your currentEnv/targetEnv. See the Configuration-Guide for all supported formats.

Linux:

{
  "projPath": "/home/user/myproject",
  "runCommand": "python run.py",
  "runFilePath": "",
  "libName": "torch",
  "currentVersion": "1.7.1",
  "targetVersion": "1.9.0",
  "currentEnv": "/home/user/anaconda3/envs/myproject_v1",
  "targetEnv": "/home/user/anaconda3/envs/myproject_v2"
}

Windows:

{
  "projPath": "C:\\Users\\user\\myproject",
  "runCommand": "python run.py",
  "runFilePath": "",
  "libName": "torch",
  "currentVersion": "1.7.1",
  "targetVersion": "1.9.0",
  "currentEnv": "C:\\Users\\user\\anaconda3\\envs\\myproject_v1",
  "targetEnv": "C:\\Users\\user\\anaconda3\\envs\\myproject_v2"
}

Step 3: Run PCART

# Run detection and repair
python main.py -cfg myproject.json

# If API definitions are missing, extract them first
python extractLibAPI.py -cfg myproject.json

On the first run, PCART instruments your project code and runs it in currentEnv to generate pkl files. These pkls capture runtime API call data and are used for dynamic API signature matching. See How-It-Works for details on the pkl lifecycle.

Step 4: View Results

Repair results are saved to Report/runs/{run_id}/{command_id}/ — each run produces an isolated output directory with the repair report and patched source files.

Next Steps

Clone this wiki locally