Skip to content

Commit 32b4222

Browse files
authored
STYLE make black local hook run twice as fast (#49947)
* make black local hook * remove old hook Co-authored-by: MarcoGorelli <>
1 parent c0bde88 commit 32b4222

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

.github/workflows/code-checks.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636

3737
- name: Run pre-commit
3838
uses: pre-commit/[email protected]
39+
with:
40+
extra_args: --verbose --all-files
3941

4042
docstring_typing_pylint:
4143
name: Docstring validation, typing, and pylint
@@ -93,7 +95,7 @@ jobs:
9395
- name: Typing + pylint
9496
uses: pre-commit/[email protected]
9597
with:
96-
extra_args: --hook-stage manual --all-files
98+
extra_args: --verbose --hook-stage manual --all-files
9799
if: ${{ steps.build.outcome == 'success' && always() }}
98100

99101
- name: Run docstring validation script tests

.pre-commit-config.yaml

+10-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ repos:
1717
entry: python scripts/run_vulture.py
1818
pass_filenames: true
1919
require_serial: false
20-
- repo: https://github.com/python/black
21-
rev: 22.10.0
22-
hooks:
23-
- id: black
2420
- repo: https://github.com/codespell-project/codespell
2521
rev: v2.2.2
2622
hooks:
@@ -114,6 +110,16 @@ repos:
114110
additional_dependencies: *flake8_dependencies
115111
- repo: local
116112
hooks:
113+
# NOTE: we make `black` a local hook because if it's installed from
114+
# PyPI (rather than from source) then it'll run twice as fast thanks to mypyc
115+
- id: black
116+
name: black
117+
description: "Black: The uncompromising Python code formatter"
118+
entry: black
119+
language: python
120+
require_serial: true
121+
types_or: [python, pyi]
122+
additional_dependencies: [black==22.10.0]
117123
- id: pyright
118124
# note: assumes python env is setup and activated
119125
name: pyright

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ dependencies:
8585
- cxx-compiler
8686

8787
# code checks
88-
- black=22.3.0
88+
- black=22.10.0
8989
- cpplint
9090
- flake8=6.0.0
9191
- flake8-bugbear=22.7.1 # used by flake8, find likely bugs

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ py
6262
moto
6363
flask
6464
asv
65-
black==22.3.0
65+
black==22.10.0
6666
cpplint
6767
flake8==6.0.0
6868
flake8-bugbear==22.7.1

0 commit comments

Comments
 (0)