Skip to content

Configuration Guide

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

Configuration Guide

Complete reference for PCART configuration files.

Configuration File Location

Placing the JSON configuration file in Configure/ is convenient but not required. Both main.py and extractLibAPI.py use the same -cfg resolution rules: an absolute path is used directly, an existing relative path is resolved from the current working directory, and any other value is looked up under the repository's Configure/ directory.

Configuration Fields

Field Type Required Description
projPath string Yes Absolute project root, or a path relative to the PCART repository root
runCommand string Yes Command to run your project (see supported formats below)
runFilePath string Yes Entry-file directory relative to projPath; use "" for the project root
libName string Yes Library name as used in your code
currentVersion string Yes Current library version
targetVersion string Yes Target library version
currentEnv string Yes Current-version environment root, absolute or relative to the PCART repository root
targetEnv string Yes Target-version environment root, absolute or relative to the PCART repository root

Field Details

projPath

Path to your project root directory. Absolute paths are supported. Relative paths are resolved from the PCART repository root, not from the configuration file's directory.

Linux:

"projPath": "/home/user/myproject"

Windows:

"projPath": "C:\\Users\\user\\myproject"

Relative to the PCART repository root:

"projPath": "Example/Deep-Graph-Kernels"

runCommand

The command used to run your project. PCART automatically detects the Python executable from your virtual environment and normalizes the command using shlex-based parsing.

Supported formats:

Format Example Notes
python <script> python run.py Most common
python <script> <args> python run.py --verbose Arguments preserved
python3 <script> python3 main.py Common Linux spelling; PCART still uses the configured environment interpreter
py -X.Y <script> py -3.9 train.py Windows py launcher
python -m <module> python -m pytest Module execution
Console script pytest, flask run Resolved from currentEnv/targetEnv bin or Scripts dir

How PCART resolves the Python executable:

  1. If the command starts with a Python executable name (python, python3, python3.x), PCART locates the matching interpreter inside the configured virtual environment (currentEnv or targetEnv).
  2. If the command starts with the Windows py launcher, the version selector (-3.9, -3) is stripped and the remaining command is run with the virtual environment's Python.
  3. If the command starts with -m or a .py file directly, it is treated as a Python command.
  4. Otherwise, PCART treats it as a console script and resolves the executable from <env>/bin/ (Linux) or <env>/Scripts/ (Windows).

Examples:

"runCommand": "python run.py"

Standard Python script.

"runCommand": "python run.py --epochs 100 --batch-size 32"

Python script with arguments.

"runCommand": "python3 src/main.py"

Linux python3.

"runCommand": "py -3.9 test_script.py"

Windows py launcher.

"runCommand": "python -m pytest tests/"

Module execution.

"runCommand": "flask run"

Console script (Flask, pytest, etc.).

Note: The currentEnv/targetEnv paths must be the root directory of the virtual environment (e.g., /home/user/anaconda3/envs/myenv), not the full path to the Python executable. PCART internally locates the interpreter based on the platform conventions:

  • Linux: <env>/bin/python
  • Windows: <env>/python.exe or <env>/Scripts/python.exe

runFilePath

Directory of the project's entry file, relative to projPath. PCART uses it to place runtime helper scripts and, when the directory is not already part of runCommand, as the command's working directory. It does not limit source analysis: PCART recursively discovers Python files under the entire projPath.

Scenario Example
Entry file in project root "runCommand": "python run.py", "runFilePath": ""
Command includes entry-file directory "runCommand": "python src/main.py", "runFilePath": "src"
Command runs from entry-file directory "runCommand": "python main.py", "runFilePath": "src"

Examples:

runCommand projPath runFilePath
python run.py /home/user/project ""
python src/main.py /home/user/project "src"
python src/utils/main.py /home/user/project "src/utils"

libName

The library name as it appears in your Python code imports.

Library libName
PyTorch torch
NumPy numpy
SciPy scipy
Pillow PIL
scikit-learn sklearn
Matplotlib matplotlib
Pandas pandas

Example:

# In your code
import torch
from PIL import Image

# Configuration
"libName": "torch"
# or
"libName": "PIL"

currentVersion / targetVersion

The current and target library versions you want to upgrade between.

"currentVersion": "1.7.1",
"targetVersion": "1.9.0"

currentEnv / targetEnv

Paths to the virtual environment root directories containing the respective library versions. Do not use the full path to the Python executable. Absolute paths are recommended for portability between invocation directories; relative paths are resolved from the PCART repository root.

Conda environments:

"currentEnv": "/home/user/anaconda3/envs/myproject_v1",
"targetEnv": "/home/user/anaconda3/envs/myproject_v2"

Virtualenv:

"currentEnv": "/home/user/venv/myproject_v1",
"targetEnv": "/home/user/venv/myproject_v2"

Windows conda:

"currentEnv": "C:\\Users\\user\\anaconda3\\envs\\myproject_v1",
"targetEnv": "C:\\Users\\user\\anaconda3\\envs\\myproject_v2"

Complete Example

Linux Configuration

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

Windows Configuration

{
  "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\\torch_v1",
  "targetEnv": "C:\\Users\\user\\anaconda3\\envs\\torch_v2"
}

Cross-Platform Notes

  • On Windows, you can use either backslashes (\\) or forward slashes (/) in paths
  • PCART automatically handles path separator conversion internally
  • Absolute projPath, currentEnv, and targetEnv values are the most portable; relative values are resolved from the PCART repository root
  • runFilePath is relative to projPath and may be empty
  • Windows py launcher version selectors (-3.9, -3) are automatically stripped
  • Console scripts are resolved from <env>/bin/ on Linux and <env>/Scripts/ on Windows

Related Pages

Clone this wiki locally