[GRASS-dev] black: Python code formatter (eg PEP8)

Panagiotis Mavrogiorgos pmav99 at gmail.com
Wed May 29 01:07:20 PDT 2019


Hello all,

The main problem with adopting style checkers so late in a project's life
is that they usually introduce really vast changes. You practically end up
with a huge commit that touches each and every python file. Needless to say
this makes using e.g. git blame much much harder.

If you want to test it out, please try the following from a clean state:

cd lib/python

git status     # make sure that no files have any changes in lib/python

black --exclude OBJ ./
> git diff --patience --minimal ./ | wc -l


That's a 75k+ line diff and that's only the "grass" library. The gui should
give something similar.

To restore the repo, just run:

git checkout ./


That being said, I do use black in practically all my new projects, usually
applying it via pre-commit <https://pre-commit.com/>, and it works great,
but I am not sure if it is truly an option for GRASS.

all the best,
P.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20190529/2900ffac/attachment.html>


More information about the grass-dev mailing list