Skip to content

Unify python code style

Markus Holzer requested to merge Add_python_formating into master

There are many python files in the waLberla framework, and the number is consistently growing due to the increasing usage of code generation. Thus, there should be a PEP8 conform style guide to ensure a consistent formatting among these files. A good overview of different python linter tools can be found here.

For the style guide in waLBerla I suggest flake8 since it is a wrapper around PyFlakes, pycodestyle, and Ned Batchelder’s McCabe script. flake8 can be installed via pip. From the waLBerla folder, the tool can be used by calling flake8 apps for example, which states all complaints of all python files in the apps folder. The same can be done for single files or for the whole waLBerla folder.

In the .flake8 file one can then specify the formating.

If we decide to use it as a coding style guideline I would suggest to also enforce the style guide via CI. The same is done in the pystencils package with a simple flake8 pystencils call.

Edited by Markus Holzer

Merge request reports