Skip to content

Commit 2e34d75

Browse files
authored
Prepare auto-formatting with black (#364)
Also removes autopep8 and prepares configuration for import sorter isort. Signed-off-by: Christian Heimes <cheimes@redhat.com>
1 parent 605a34b commit 2e34d75

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

Doc/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Notable targets are:
108108
Note that no backups are made – please commit any other changes before
109109
using this target.
110110

111-
Requires the ``indent`` program and the ``autopep8`` Python module.
111+
Requires the ``indent`` program and the ``black`` Python module.
112112

113113
.. _PEP 7: https://www.python.org/dev/peps/pep-0007/
114114
.. _PEP 8: https://www.python.org/dev/peps/pep-0008/

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LCOV_REPORT_OPTIONS=--show-details -no-branch-coverage \
55
--title "python-ldap LCOV report"
66
SCAN_REPORT=build/scan_report
77
PYTHON_SUPP=/usr/share/doc/python3-devel/valgrind-python.supp
8-
AUTOPEP8_OPTS=--aggressive
8+
99

1010
.NOTPARALLEL:
1111

@@ -85,13 +85,15 @@ valgrind: build $(PYTHON_SUPP)
8585
fi
8686

8787
# Code autoformatter
88-
.PHONY: autoformat indent autopep8
89-
autoformat: indent autopep8
88+
.PHONY: autoformat indent black black-check
89+
autoformat: indent black
9090

9191
indent:
9292
indent Modules/*.c Modules/*.h
9393
rm -f Modules/*.c~ Modules/*.h~
9494

95-
autopep8:
96-
$(PYTHON) -m autopep8 -r -i -j0 $(AUTOPEP8_OPTS) \
97-
Demo Lib Tests setup.py
95+
black:
96+
$(PYTHON) -m black $(CURDIR)
97+
98+
black-check:
99+
$(PYTHON) -m black $(CURDIR) --check

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[tool.black]
2+
line-length = 88
3+
target-version = ['py36', 'py37', 'py38']
4+
5+
[tool.isort]
6+
line_length=88
7+
known_first_party=['ldap', '_ldap', 'ldapurl', 'ldif', 'slapdtest']
8+
sections=['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER']

0 commit comments

Comments
 (0)