Skip to content

Instantly share code, notes, and snippets.

@sequoiap
Last active October 24, 2023 23:54
Show Gist options
  • Save sequoiap/ae0ecc5d7f857c67fdb72be2ee725a47 to your computer and use it in GitHub Desktop.
Save sequoiap/ae0ecc5d7f857c67fdb72be2ee725a47 to your computer and use it in GitHub Desktop.
Canonical pre-commit configuration for a Python project
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: check-json
- id: check-merge-conflict
- id: mixed-line-ending
- id: end-of-file-fixer
types: [python]
- id: trailing-whitespace
types: [python]
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
hooks:
- id: autoflake
args: [--remove-all-unused-imports, --in-place]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
files: src/.*
args: [--profile, black, --filter-files]
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.3.0
- repo: https://github.com/PyCQA/docformatter
rev: v1.6.5
hooks:
- id: docformatter
args: [--in-place]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
hooks:
- id: mypy
exclude: ^(docs/)
# - repo: https://github.com/kynan/nbstripout
# rev: 0.6.1
# hooks:
# - id: nbstripout
# files: ".ipynb"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment