From 3ef281595a4f331d22811dfbb82f1580f92d027e Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Mon, 28 Nov 2022 20:36:23 +0000 Subject: [PATCH 1/2] make black local hook --- .github/workflows/code-checks.yml | 4 +++- .pre-commit-config.yaml | 10 ++++++++++ environment.yml | 2 +- requirements-dev.txt | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 7a90e1bec7783..540e9481befd6 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -36,6 +36,8 @@ jobs: - name: Run pre-commit uses: pre-commit/action@v2.0.3 + with: + extra_args: --verbose --all-files docstring_typing_pylint: name: Docstring validation, typing, and pylint @@ -93,7 +95,7 @@ jobs: - name: Typing + pylint uses: pre-commit/action@v2.0.3 with: - extra_args: --hook-stage manual --all-files + extra_args: --verbose --hook-stage manual --all-files if: ${{ steps.build.outcome == 'success' && always() }} - name: Run docstring validation script tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cc6875589c691..5203348ee34fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -114,6 +114,16 @@ repos: additional_dependencies: *flake8_dependencies - repo: local hooks: + # NOTE: we make `black` a local hook because if it's installed from + # PyPI (rather than from source) then it'll run twice as fast thanks to mypyc + - id: black + name: black + description: "Black: The uncompromising Python code formatter" + entry: black + language: python + require_serial: true + types_or: [python, pyi] + additional_dependencies: [black==22.10.0] - id: pyright # note: assumes python env is setup and activated name: pyright diff --git a/environment.yml b/environment.yml index 7cd8859825453..e7430d7a4084f 100644 --- a/environment.yml +++ b/environment.yml @@ -85,7 +85,7 @@ dependencies: - cxx-compiler # code checks - - black=22.3.0 + - black=22.10.0 - cpplint - flake8=5.0.4 - flake8-bugbear=22.7.1 # used by flake8, find likely bugs diff --git a/requirements-dev.txt b/requirements-dev.txt index 78dddbe607084..c17915db60ca7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -62,7 +62,7 @@ py moto flask asv -black==22.3.0 +black==22.10.0 cpplint flake8==5.0.4 flake8-bugbear==22.7.1 From 425965a0b24e7ad8ffdfbb2d1a52a11795924ef4 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Tue, 29 Nov 2022 08:24:13 +0000 Subject: [PATCH 2/2] remove old hook --- .pre-commit-config.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5203348ee34fb..869dbd2d67e8b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,10 +17,6 @@ repos: entry: python scripts/run_vulture.py pass_filenames: true require_serial: false -- repo: https://github.com/python/black - rev: 22.10.0 - hooks: - - id: black - repo: https://github.com/codespell-project/codespell rev: v2.2.2 hooks: