Skip to content

Commit 9d8b429

Browse files
authored
move black & flake8 to precommit (#739)
* move `black` & `flake8` to precommit * update name * One line
1 parent 8f16a9f commit 9d8b429

File tree

6 files changed

+25
-31
lines changed

6 files changed

+25
-31
lines changed

.github/workflows/ci.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ jobs:
2929
set -xe
3030
python -VV
3131
python -m site
32-
python -m pip install --upgrade pip setuptools wheel
33-
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions
32+
python -m pip install --upgrade pip setuptools wheel coverage[toml] virtualenv tox tox-gh-actions
3433
3534
- name: "Run tox targets for ${{ matrix.python-version }}"
3635
run: python -m tox
@@ -47,7 +46,7 @@ jobs:
4746
strategy:
4847
fail-fast: false
4948
matrix:
50-
toxenv: ["flake8", "black", "manifest", "docs", "binder"]
49+
toxenv: ["manifest", "docs", "binder"]
5150
env:
5251
TOXENV: ${{ matrix.toxenv }}
5352
steps:

.pre-commit-config.yaml

+19-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ci:
88

99
repos:
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.3.0
11+
rev: v4.5.0
1212
hooks:
1313
- id: end-of-file-fixer
1414
- id: trailing-whitespace
@@ -21,7 +21,7 @@ repos:
2121
- id: detect-private-key
2222

2323
- repo: https://github.com/asottile/pyupgrade
24-
rev: v2.37.3
24+
rev: v3.15.0
2525
hooks:
2626
- id: pyupgrade
2727
args: [--py37-plus]
@@ -38,21 +38,31 @@ repos:
3838
# hooks:
3939
# - id: isort
4040

41-
#- repo: https://github.com/psf/black
42-
# rev: 22.6.0
43-
# hooks:
44-
# - id: black
45-
# name: Black code
41+
- repo: https://github.com/psf/black
42+
rev: 23.11.0
43+
hooks:
44+
- id: black
45+
name: Black code
46+
args: ["-S"]
4647

4748
- repo: https://github.com/executablebooks/mdformat
48-
rev: 0.7.15
49+
rev: 0.7.17
4950
hooks:
5051
- id: mdformat
5152
additional_dependencies:
5253
- mdformat-gfm
5354
- mdformat_frontmatter
5455

5556
- repo: https://github.com/asottile/yesqa
56-
rev: v1.4.0
57+
rev: v1.5.0
5758
hooks:
5859
- id: yesqa
60+
61+
- repo: https://github.com/pycqa/flake8
62+
rev: 6.1.0
63+
hooks:
64+
- id: flake8
65+
arge:
66+
- "--count"
67+
- "--show-source"
68+
- "--statistics"

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ recursive-include papermill *.txt
88

99
include setup.py
1010
include requirements.txt
11-
include tox_py_installer
11+
include tox_py_installer.sh
1212
recursive-include requirements *.txt
1313
include docs/requirements.txt
1414
include tox.ini

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
[tool.black]
99
line-length = 100
10+
target-version = ['py312']
1011
include = '\.pyi?$'
1112
exclude = '''
1213
/(

tox.ini

+2-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
skipsdist = true
3-
envlist = py{38,39,310,311,312}, flake8, dist, manifest, docs, binder
3+
envlist = py{38,39,310,311,312}, dist, manifest, docs, binder
44

55
[gh-actions]
66
python =
@@ -10,12 +10,6 @@ python =
1010
3.11: py311
1111
3.12: py312, dist
1212

13-
# Linters
14-
[testenv:flake8]
15-
skip_install = true
16-
deps = flake8
17-
commands = flake8 papermill --count --show-source --statistics
18-
1913
# Manifest
2014
[testenv:manifest]
2115
skip_install = true
@@ -48,14 +42,6 @@ commands =
4842
python setup.py sdist --dist-dir={distdir} bdist_wheel --dist-dir={distdir}
4943
/bin/bash -c 'python -m pip install -U --force-reinstall {distdir}/papermill*.whl'
5044

51-
# Black
52-
[testenv:black]
53-
description = apply black linter with desired rules
54-
basepython = python3.12
55-
deps =
56-
black
57-
commands = black -S -l 100 .
58-
5945
[testenv]
6046
# disable Python's hash randomization for tests that stringify dicts, etc
6147
setenv =
@@ -69,15 +55,13 @@ basepython =
6955
py310: python3.10
7056
py311: python3.11
7157
py312: python3.12
72-
flake8: python3.12
7358
manifest: python3.12
7459
dist: python3.12
7560
docs: python3.12
7661
binder: python3.12
77-
black: python3.12
7862
deps = .[dev]
7963
# Have to use /bin/bash or the `*` will cause that argument to get quoted by the tox command line...
8064
allowlist_externals = /bin/bash
8165
# Python 3.12 breaks default pip/setuptools versions ... force an upgrade of these before anything else
82-
install_command = /bin/bash ./tox_py_installer {opts} {packages}
66+
install_command = /bin/bash ./tox_py_installer.sh {opts} {packages}
8367
commands = pytest -v --maxfail=2 --cov=papermill -W always {posargs}
File renamed without changes.

0 commit comments

Comments
 (0)