Skip to content

Instantly share code, notes, and snippets.

@xiaohan2012
Last active October 11, 2024 18:52
Show Gist options
  • Save xiaohan2012/e01133f4bb6a22f107372fe636b50481 to your computer and use it in GitHub Desktop.
Save xiaohan2012/e01133f4bb6a22f107372fe636b50481 to your computer and use it in GitHub Desktop.
default_language_version:
python: python3.11
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-added-large-files
- id: check-merge-conflict
- id: detect-private-key
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.0
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: python3.11
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
# notebook related
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.0
hooks:
- id: nbqa-black
additional_dependencies: [black==23.7.0]
- id: nbqa-isort
additional_dependencies: [isort==5.12.0]
args: ["--float-to-top"]
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==3.15.0]
args: ["--py38-plus"]
# clear output of Jupyter notebooks
- repo: local
hooks:
- id: jupyter-nb-clear-output
name: jupyter-nb-clear-output
files: \.ipynb$
language: python
entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment