| title | Contributing |
|---|
Guidelines for contributing to the QuantEcon Style Guide Checker.
- uv (handles Python, venv, and deps for you)
- Git
- GitHub account
# 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.
- Follow PEP 8
- Use type hints
- Add docstrings to all functions/classes
- Keep functions focused and small
- Comment complex logic (explain "why", not "what")
- 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 cRules 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
- Create
style_checker/rules/{category}-rules.md - Add the new name to
VALID_CATEGORIESinstyle_checker/categories.py - Add 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
- Fork the repository
- Create feature branch:
git checkout -b feature/your-feature-name - Make changes — write clean, documented code
- Run tests:
pytest tests/ -v - Commit with clear messages using conventional commits
- Push and create PR with clear description
feat:New featurefix:Bug fixdocs:Documentation changesrefactor:Code refactoringtest:Adding testschore:Maintenance tasks
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.
- Make changes
- Run full test suite:
uv run pytest tests/ -v - Update
__version__instyle_checker/__init__.py - Regenerate the lockfile:
uv lock(commit the diff) - Update prompt versions if prompts were modified
- Update
CHANGELOG.md - Commit:
Release vX.Y.Z - Description - Create GitHub release:
gh release create vX.Y.Z - Update floating tag:
git tag -f v0.7 && git push origin v0.7 --force
- 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
Include:
- Description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Python version)
- Relevant logs or error messages