<div dir="ltr"><div><br><br>On Mon, May 20, 2019 at 8:31 AM Markus Neteler <<a href="mailto:neteler@osgeo.org" target="_blank">neteler@osgeo.org</a>> wrote:<br>><br>> Back - Python code formatter (eg. PEP8)<br>> <a href="https://github.com/python/black" target="_blank">https://github.com/python/black</a><br><br></div>I like that, although I don't understand why they didn't decide for 4 spaces for first indent level and 1 tab for the second one ;-) But on a serious note:<br><div><br>> Would that be useful for us?<br></div><div><br></div><div>Yes, I think we should adopt it. The philosophy of no settings is great. I write with PEP8 (pycodestyle/pep8), but there is still too many options. From the tools Black, YAPF, pep8ify, and autopep8, Black seems the best in several ways (strict style, close to core Python devs, more predicable and consistent, better style) as long as one accepts the style without questions (as if it would be part of the language).</div><div><br></div><div>It is worth noting that it will likely introduce many changes into our code. Some of Black's practices are different from what we are using (e.g. "single quotes for data, double quotes for text"). Additionally, if I remember correctly, after we applied autopep8 to wxGUI, several places were broken, although we were working on PEP8 compliance long time before that. It should be significantly better this time especially because the main problem were mixed tabs and spaces in that case. However with `--check --skip-string-normalization --line-length` and couple of `# fmt: on/off`, we can use it right away for checks.<br><br></div><div>We already have settings for pycodestyle/pep8 and Pylint in tools directory. The reason I have never added that to makefiles was that I didn't want to introduce it as a dependency. Perhaps there is a way  in makefiles to make it optional. Same goes for Black too. Of course the check could be only in CI, but for that we really need to apply the style fully first.<br></div><div><br></div><div>The problem with applying it fully is that it is in beta and they warn that the style may change (to different subset of PEP8). I think we should test it first anyway.</div><div><br></div><div>I encourage everybody to use it locally for checks of old files and apply it to new ones. After some time, we can apply it fully.<br></div><div><br></div><div>Best,</div><div>Vaclav<br></div></div>