From f3f84bac3f5e9b98b6e5977259a862510c2bbd35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 14 May 2021 18:39:22 +0200 Subject: [PATCH] misc: add black files/notes --- .git-blame-ignore-revs | 2 ++ .pre-commit-config.yaml | 13 +++++++++++++ README | 15 +++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 .git-blame-ignore-revs create mode 100644 .pre-commit-config.yaml diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..3bf5cc5 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# trivial: apply black & isort +872f39774a43db59ffc4bbddc77ad3a33ba7ead2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c6a0c57 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,13 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110'] +- repo: https://github.com/PyCQA/isort + rev: 5.7.0 + hooks: + - id: isort + args: ['--profile', 'black', '--line-length', '110'] diff --git a/README b/README index e96287e..86432c2 100644 --- a/README +++ b/README @@ -171,3 +171,18 @@ For testing multitenant framework, do in a virtualenv: pip install pytest pytest-django python-memcached mock . cd tests_multitenant ; PYTHONPATH=. DJANGO_SETTINGS_MODULE=settings py.test . + + +Code Style +---------- + +black is used to format the code, using thoses parameters: + + black --target-version py37 --skip-string-normalization --line-length 110 + +isort is used to format the imports, using those parameters: + + isort --profile black --line-length 110 + +There is .pre-commit-config.yaml to use pre-commit to automatically run black and isort +before commits. (execute `pre-commit install` to install the git hook.)