Thank you for your interest in contributing to PyGate! This guide will help you get started.
git clone https://github.com/roli-lpci/quick-gate-python.git
cd quick-gate-python
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"pytest tests/ -vruff check src/ tests/
ruff format --check src/ tests/pyright src/- Fork the repository and create a feature branch from
main. - Write tests for any new functionality or bug fixes.
- Follow existing code style — the project uses ruff for formatting and linting.
- Keep commits focused — one logical change per commit.
- Update CHANGELOG.md under the
[Unreleased]section.
- Ensure all tests pass (
pytest tests/ -v). - Ensure linting passes (
ruff check src/ tests/). - Update documentation if your change affects user-facing behavior.
- Fill out the PR template with a clear description of your changes.
- Request a review.
src/pygate/
├── cli.py # Argparse CLI entrypoint
├── models.py # All Pydantic v2 models (single source of truth)
├── constants.py # Directory paths, policy defaults, escalation codes
├── config.py # Load pygate.toml / pyproject.toml config
├── exec.py # Subprocess wrapper → CommandTrace
├── env.py # Environment detection (Python, platform, packages)
├── fs.py # File utilities (JSON read/write, changed files)
├── gates/
│ ├── __init__.py # Gate orchestrator
│ ├── ruff.py # Ruff lint output parser
│ ├── pyright.py # Pyright typecheck output parser
│ └── pytest_gate.py # Pytest json-report parser
├── run_command.py # `pygate run` implementation
├── summarize_command.py # `pygate summarize` implementation
├── repair_command.py # `pygate repair` bounded loop
└── deterministic_fix.py # ruff --fix + format strategies
Key principles:
- Pydantic models are the schema — models in
models.pyare the single source of truth. JSON Schema files inschemas/are generated from these models for downstream validation and code generation. - Deterministic only (v1) — no model-assisted or AI-powered repairs.
- Structured artifacts — every operation produces machine-readable JSON. See
demo/artifacts/for sample output.
The eval/ directory contains a real-world evaluation suite with 8 scenarios:
python eval/run_eval.pyThis requires pygate, ruff, pyright, and pytest (with pytest-json-report) to be installed and on PATH.
- Use the bug report template for bugs.
- Use the feature request template for ideas.
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.