Skip to content

Commit

Permalink
Prepare auto-formatting with black (#364)
Browse files Browse the repository at this point in the history
Also removes autopep8 and prepares configuration for import sorter
isort.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
  • Loading branch information
Christian Heimes authored and GitHub committed Jul 13, 2020
1 parent 605a34b commit 2e34d75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Notable targets are:
Note that no backups are made – please commit any other changes before
using this target.

Requires the ``indent`` program and the ``autopep8`` Python module.
Requires the ``indent`` program and the ``black`` Python module.

.. _PEP 7: https://www.python.org/dev/peps/pep-0007/
.. _PEP 8: https://www.python.org/dev/peps/pep-0008/
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LCOV_REPORT_OPTIONS=--show-details -no-branch-coverage \
--title "python-ldap LCOV report"
SCAN_REPORT=build/scan_report
PYTHON_SUPP=/usr/share/doc/python3-devel/valgrind-python.supp
AUTOPEP8_OPTS=--aggressive


.NOTPARALLEL:

Expand Down Expand Up @@ -85,13 +85,15 @@ valgrind: build $(PYTHON_SUPP)
fi

# Code autoformatter
.PHONY: autoformat indent autopep8
autoformat: indent autopep8
.PHONY: autoformat indent black black-check
autoformat: indent black

indent:
indent Modules/*.c Modules/*.h
rm -f Modules/*.c~ Modules/*.h~

autopep8:
$(PYTHON) -m autopep8 -r -i -j0 $(AUTOPEP8_OPTS) \
Demo Lib Tests setup.py
black:
$(PYTHON) -m black $(CURDIR)

black-check:
$(PYTHON) -m black $(CURDIR) --check
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tool.black]
line-length = 88
target-version = ['py36', 'py37', 'py38']

[tool.isort]
line_length=88
known_first_party=['ldap', '_ldap', 'ldapurl', 'ldif', 'slapdtest']
sections=['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER']

0 comments on commit 2e34d75

Please sign in to comment.