dianna icon indicating copy to clipboard operation
dianna copied to clipboard

Add linting for jupyter notebooks

Open stefsmeets opened this issue 1 year ago • 0 comments

I came across this library recently: https://github.com/nbQA-dev/nbQA

With it, you can lint notebooks with the same tools you use to lint regular python files.

Adding this snippet to .pre-commit-config.yaml enables yapf / ruff.

  - repo: https://github.com/nbQA-dev/nbQA
    rev: 1.7.0
    hooks:
      - id: nbqa-yapf
        additional_dependencies: [toml, yapf]
        types_or: [jupyter]
      - id: nbqa-ruff
        args: [--fix, --ignore=E402]
        types_or: [jupyter]

stefsmeets avatar Apr 12 '23 12:04 stefsmeets