Skip to content

Commit 6c9096f

Browse files
committed
add black configuration
1 parent 82bc8df commit 6c9096f

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
arch: x64
8787
os: windows-latest
8888
toxenv: type
89-
- name: Code style with flake8
89+
- name: Formatting with Black and code style with flake8
9090
python: '3.7'
9191
arch: x64
9292
os: ubuntu-latest

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ requires = [
44
"wheel >= 0.30.0",
55
]
66
build-backend = "setuptools.build_meta"
7+
8+
[tool.black]
9+
line-length = 99
10+
target-version = ['py36']
11+
extend-exclude = '''
12+
^/mypy/typeshed|
13+
^/test-data
14+
'''

runtests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
'self': [executable, '-m', 'mypy', '--config-file', 'mypy_self_check.ini', '-p', 'mypy'],
4848
# Lint
4949
'lint': ['flake8', '-j0'],
50+
"format": ["black", "."],
5051
# Fast test cases only (this is the bulk of the test suite)
5152
'pytest-fast': ['pytest', '-q', '-k', 'not (%s)' % ' or '.join(ALL_NON_FAST)],
5253
# Test cases that invoke mypy (with small inputs)

setup.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ exclude =
3434

3535
# Things to ignore:
3636
# E128: continuation line under-indented (too noisy)
37+
# E203: conflicts with black
38+
# E501: conflicts with black
3739
# W601: has_key() deprecated (false positives)
3840
# E701: multiple statements on one line (colon) (we use this for classes with empty body)
3941
# E704: multiple statements on one line (def)
@@ -44,7 +46,7 @@ exclude =
4446
# B011: Don't use assert False
4547
# F821: Name not defined (generates false positives with error codes)
4648
# E741: Ambiguous variable name
47-
extend-ignore = E128,W601,E701,E704,E402,B3,B006,B007,B011,F821,E741
49+
extend-ignore = E128,E203,E501,W601,E701,E704,E402,B3,B006,B007,B011,F821,E741
4850

4951
[coverage:run]
5052
branch = true

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-r mypy-requirements.txt
22
-r build-requirements.txt
33
attrs>=18.0
4+
black==22.1.0
45
flake8==3.9.2
56
flake8-bugbear==22.3.20
67
flake8-pyi>=20.5

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ parallel_show_output = True
4444
[testenv:lint]
4545
description = check the code style
4646
basepython = python3.7
47-
commands = flake8 {posargs}
47+
commands =
48+
flake8 {posargs}
49+
black --check --diff .
4850

4951
[testenv:type]
5052
description = type check ourselves

0 commit comments

Comments
 (0)