[PATCH 04 of 11 logilab-common] [README] add instruction on how to use and integrate black

Laurent Peuch cortex at worlddomination.be
Wed Apr 1 16:20:05 CEST 2020


# HG changeset patch
# User Laurent Peuch <cortex at worlddomination.be>
# Date 1585750264 -7200
#      Wed Apr 01 16:11:04 2020 +0200
# Node ID e9cc645c6e4e965efcc68e513fc692380095c334
# Parent  619070abee7c1d40c6555024b34547e60882ec74
# Available At https://hg.logilab.org/users/lpeuch/logilab-common
#              hg pull https://hg.logilab.org/users/lpeuch/logilab-common -r e9cc645c6e4e
# EXP-Topic types-annotations-and-cleaning
[README] add instruction on how to use and integrate black

Taken from yams taken from nemo

diff --git a/.hgrc b/.hgrc
new file mode 100644
--- /dev/null
+++ b/.hgrc
@@ -0,0 +1,3 @@
+[hooks]
+precommit.black = tox -e black-run
+pre-amend.black = tox -e black-run
diff --git a/README b/README
--- a/README
+++ b/README
@@ -64,6 +64,17 @@ Then build the doc ::
 
 It's now available under `doc/_build/html/`
 
+Code style
+----------
+
+The python code is verified against *flake8* and formatted with *black*.
+
+* You can run `tox -e black` to check that the files are well formatted.
+* You can run `tox -e black-run` to format them if needed.
+* You can include the `.hgrc` to your own `.hgrc` to automatically run black
+  before each commit/amend. This can be done by writing `%include ../.hgrc` at
+  the end of your `.hgrc`.
+
 Comments, support, bug reports
 ------------------------------
 




More information about the cubicweb-devel mailing list