Guidelines for contributing to the QuantEcon Style Guide Checker.
Development Setup¶
Prerequisites¶
uv (handles Python, venv, and deps for you)
Git
GitHub account
Local Development¶
# Clone
git clone https://github.com/QuantEcon/action-style-guide.git
cd action-style-guide
# uv reads pyproject.toml + uv.lock and creates a .venv automatically.
# --all-extras installs PyGithub (action) + pytest/ruff (dev).
uv sync --all-extras
# Run commands via `uv run` (no need to activate the venv):
uv run qestyle --version
uv run pytest tests/
# Set up API keys
export ANTHROPIC_API_KEY="your-key"
export GITHUB_TOKEN="your-token"Don’t want
uv? You can still usepip install -e ".[dev,action]"— the dependency manifest is the same.uvjust makes installs faster and reproducible viauv.lock.
Code Style¶
Follow PEP 8
Use type hints
Add docstrings to all functions/classes
Keep functions focused and small
Comment complex logic (explain “why”, not “what”)
Guiding Principles¶
Simplicity above all — write the simplest code that works
Direct over abstract — don’t abstract until you have 3+ use cases
Readable over concise — explicit is better than implicit
Less code = less bugs — every line is a liability
# Good: Simple, clear, explicit
def apply_fix(content: str, violation: dict) -> str:
"""Apply a single fix to content."""
old_text = violation['current_text']
new_text = violation['suggested_fix']
return content.replace(old_text, new_text, 1)
# Avoid: Clever, requires mental parsing
def apply_fix(c, v):
return c.replace(v['ct'], v['sf'], 1) if 'ct' in v and 'sf' in v else cAdding New Rules¶
Rules are in style_checker/rules/ and are read directly by the LLM — no code changes needed.
Edit the appropriate rules file (e.g.,
style_checker/rules/writing-rules.md)Follow the existing format:
### Rule: qe-writing-001 **Type:** rule **Title:** Use one sentence per paragraph **Description:** [Detailed explanation] **Check for:** [Specific patterns to identify] **Examples:** [Good and bad examples]The base prompt (
prompts/prompt.md) is shared across all categories; usually no edit needed there.Test with real lecture files
Adding a New Category¶
Create
style_checker/rules/{category}-rules.mdAdd the new name to
VALID_CATEGORIESinstyle_checker/categories.pyAdd an entry for it in
RULE_EVALUATION_ORDERinstyle_checker/reviewer.py(the test suite will fail loudly if the keys drift)Test end-to-end
Pull Request Process¶
Fork the repository
Create feature branch:
git checkout -b feature/your-feature-nameMake changes — write clean, documented code
Run tests:
pytest tests/ -vCommit with clear messages using conventional commits
Push and create PR with clear description
Commit Message Format¶
feat:New featurefix:Bug fixdocs:Documentation changesrefactor:Code refactoringtest:Adding testschore:Maintenance tasks
Version Management¶
The version lives in one place — style_checker/__init__.py:
# In __init__.py — bump for every release
__version__ = "0.7.2"pyproject.toml reads it via [tool.setuptools.dynamic] version = {attr = "style_checker.__version__"},
so pip install qestyle and qestyle --version always report the same number.
Release Process¶
Make changes
Run full test suite:
uv run pytest tests/ -vUpdate
__version__instyle_checker/__init__.pyRegenerate the lockfile:
uv lock(commit the diff)Update prompt versions if prompts were modified
Update
CHANGELOG.mdCommit:
Release vX.Y.Z - DescriptionCreate GitHub release:
gh release create vX.Y.ZUpdate floating tag:
git tag -f v0.7 && git push origin v0.7 --force
Debugging LLM Issues¶
Check the prompt — is it clear and explicit?
Add more examples to rules
Strengthen language (e.g., “do NOT” instead of “don’t”)
Add “Important:” or “Critical:” sections
Test with isolated examples first
Reporting Issues¶
Include:
Description of the problem
Steps to reproduce
Expected vs actual behavior
Environment details (OS, Python version)
Relevant logs or error messages