Skip to content

Pre-commit Hooks

Some pre-commit hooks I use frequently.

Example .pre-commit-config.yaml file


repos:

- repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
  rev: v0.1.1
  hooks:
    - id: pre-commit-update

- repo: https://github.com/kynan/nbstripout
  rev: 0.6.1
  hooks:
    - id: nbstripout

Auto-update pre-commit hooks

This hook will update the revisions for all installed hooks each time pre-commit runs.


- repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
  rev: v0.1.1
  hooks:
    - id: pre-commit-update
      args: [--dry-run --exclude black --keep isort]

Automatically strip Jupyter notebooks on commit

This hook will scan for jupyter notebooks (.ipynb) and clear any cell output before committing.


- repo: https://github.com/kynan/nbstripout
  rev: 0.6.1
  hooks:
    - id: nbstripout
Last updated on