Contributing to ProG-V2
May 30, 2026 ยท View on GitHub
Thanks for contributing to ProG-V2. This guide describes the public development workflow, coding conventions, and validation steps expected for pull requests.
Development Setup
Use Python 3.9 or 3.11. Python 3.11 is recommended for local development.
conda create -n prog-v2 python=3.11 -y
conda activate prog-v2
pip install -e ".[dev]"
pre-commit install
Quick environment check:
python -c "import prompt_graph; print(prompt_graph.__file__)"
pytest tests/test_factory.py -v
Branches and Commits
Use one branch per goal.
| Prefix | Use case | Example |
|---|---|---|
fix/ | Bug fixes | fix/relief-node-eval-device |
feat/ | New user-facing functionality | feat/new-prompt-strategy |
refactor/ | Internal structure changes | refactor/strategy-optimizer-setup |
test/ | Test additions or fixes | test/backbone-registry |
docs/ | Documentation updates | docs/public-results |
chore/ | Maintenance | chore/update-ci |
Commit messages should use the matching prefix:
fix: handle WebKB multi-split train masks
docs: publish GCN benchmark report
test: cover strategy registration
Explain why a change is needed in the commit body when the reason is not obvious.
Coding Conventions
Paths
Do not hardcode ./data or ./Experiment in runtime code. Use helpers from
prompt_graph.utils.paths, such as:
excel_result_dirsample_dirpretrained_model_dirinduced_graph_dir
Device handling
Use prompt_graph.utils.resolve_device(device) instead of constructing
torch.device(...) directly in task setup code.
Logging
Use the project logger for intermediate state:
from prompt_graph.utils import get_logger
logger = get_logger(__name__)
logger.info("epoch %d loss=%.4f", epoch, loss)
Keep print() for user-facing final results only.
Type and compatibility notes
The project supports Python 3.9 and 3.11. Avoid runtime-only syntax that breaks Python 3.9.
Running Checks
Before opening a pull request, run:
ruff check .
ruff format --check .
pytest tests/ -v
For faster iteration:
pytest tests/test_factory.py -v
pytest tests/test_strategy_registry.py -v
pytest tests/test_strategy_gpf.py -v
Adding a Prompt Strategy
- Add a strategy implementation under
prompt_graph/tasker/strategies/. - Register it with
@register_strategy("PromptName"). - Import the module in
prompt_graph/tasker/strategies/__init__.pyso the registry is populated on package import. - Add or update initialization logic if the prompt needs custom modules.
- Add a smoke test under
tests/.
At minimum, a new strategy should be able to run a small Cora or MUTAG smoke configuration.
Adding a Backbone
- Add the model implementation or wrapper under
prompt_graph/model/. - Register it in the model factory used by
build_gnn. - Add a construction + forward smoke test in
tests/test_factory.py. - Verify at least one pretrain/downstream path with the new backbone.
Adding a Dataset
- Add loader support in
prompt_graph/data/load4data.py. - Update dataset lists in
prompt_graph/defines.py. - Add or update a data-loader smoke test.
- Ensure generated files use
prompt_graph.utils.pathshelpers.
Benchmark Results
Public merged reports should live under results/. Keep raw local outputs,
temporary merge workspaces, and machine-specific logs out of the repository.
The current public benchmark reports are:
results/benchmark-gcn/ # node- and graph-classification report
results/link-prediction-gcn/ # edge task (link prediction) report
Each contains a flat summary.csv, a final_matrices.xlsx workbook, and
bench-style per-dataset Excel matrices.
Pull Request Checklist
- The PR has one clear goal.
- New runtime code avoids hardcoded paths.
- New task/model code uses centralized device handling.
- New intermediate output uses logging instead of
print(). - Tests were added or updated for new behavior.
-
ruff check .passes. -
ruff format --check .passes. - Relevant pytest targets pass.
- Public docs/results do not include local machine or private execution metadata.