[elbe-devel] RFC: using pep8 coding style

John Ogness john.ogness at linutronix.de
Wed Dec 20 14:22:59 CET 2017


On 2017-12-20, Manuel Traut <manuel.traut at linutronix.de> wrote:
>> > Hi,
>> > 
>> > i would like to have a common coding style in elbe.
>> > PEP8 [0] describes a style-guide for python code.
>> > 
>> > There is tooling to check the coding style and for automatic refactoring.
>> > So it would be easy to ensure that we follow this coding style in the future.
>> > 
>> > $ cd elbe
>> > $ pycodestyle --statistics .
>> > 
>> > reports about 7000 coding style violations currently. After running
>> > 
>> > $ autopep8 -i -r -a -a -j 5 .
>> > 
>> > pycodestyle reports just about 100 violations. Most of them are 'E501 line to
>> > long' and some others. All can be easily fixed 'by hand':
>> > 
>> > 7       E211 whitespace before '('
>> > 6       E265 block comment should start with '# '
>> > 3       E266 too many leading '#' for block comment
>> > 2       E402 module level import not at top of file
>> > 98      E501 line too long (82 > 79 characters)
>> 
>> I am against 80 char lines. It seems to be configurable, and i would
>> like to see 120 or something.
>
> It is configurable. However PEP8 says:
>
> "Limit all lines to a maximum of 79 characters.
>
> For flowing long blocks of text with fewer structural restrictions (docstrings
> or comments), the line length should be limited to 72 characters."
>
> I would prefer to have 80 chars.

I also prefer 80 chars.

>> i generally set the tabwidth to 8. This is different to what manut does.
>
> I use 2 at the moment. I think we should also follow PEP8 and use 4
> spaces.

I've had good experiences with a tabwidth of 4 for python code. (For
other languages I prefer 8.)

John Ogness



More information about the elbe-devel mailing list