pygraphistry
pygraphistry copied to clipboard
Setup pre-commit hooks for automatic linting and type checking
Background
Issue #801 recommended setting up pre-commit hooks to catch issues before they reach CI/CD.
Proposed Setup
Install pre-commit framework and configure hooks for:
- Ruff - Fast Python linting (already in use)
- MyPy - Type checking (already in use)
- Trailing whitespace - Clean up whitespace
- End-of-file fixer - Ensure newline at EOF
- YAML/JSON validation - Catch syntax errors
Example .pre-commit-config.yaml
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.0 # Use latest version
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.0 # Use latest version
hooks:
- id: mypy
additional_dependencies: [types-all]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-added-large-files
Benefits
- Catches lint/type errors before commit
- Faster feedback loop than waiting for CI
- Reduces CI failures from trivial issues
- Consistent code quality across all commits
Installation
pip install pre-commit
pre-commit install
Priority
Long-term improvement (not urgent)
Related Issues
- #801 - Original issue recommending this improvement
🤖 Generated with Claude Code