[gdal-dev] PEP8 compliance for Python code
Ben Elliston
ben.elliston at anu.edu.au
Mon Apr 9 21:32:53 PDT 2018
The Python code in the GDAL tree covers a few things including the
testsuite and a Python module for GDAL itself. There is quite a lot of
this code and the coding conventions are a bit all over the place. There
are several deprecated idioms still being used. I think we should
settle on the Python PEP8 coding style guidelines as a way of
standardising the appearance of the code across the tree.
I have so far made a small number of changes detected with 'flake8', but
some of the changes (such as removing extraneous spaces around
parentheses) are quite invasive and should be done more carefully.
I propose to use the 'autopep8' tool to automatically fix all of the
trivial problems to do with whitespace. This is much faster than manual
editing and reduces the risk of errors. I plan to inspect the diffs and
run 'git diff -w' to double check that there are no non-whitespace
changes. The changes would be made one warning category at a time, on
cascading (serial) git branches so that there will be minimal merge
conflicts. Having a number of parallel branches is just asking for many
merge conflicts.
At the end of all this, we can enable flake8 support in Travis CI to
maintain compliance with the coding standard.
Thoughts?
Cheers, Ben
More information about the gdal-dev
mailing list