How to tell Spyder's style analysis PEP8 to read from a setup.cfg or increase max. line length?

venti picture venti · Oct 17, 2014 · Viewed 9.6k times · Source

I am using Spyder 2.3.1 and python(x, y).

In the preferences of Spyder you can activate "Style analysis". This is quite nice, but I want to increase the max. tolerable line length. The standard setting for PEP8 is 79 characters. This can be changed through a setup.cfg with the content:

[pep8]
max-line-length = 99

This can be read here: http://pep8.readthedocs.org/en/latest/intro.html#related-tools

Where do I put a setup.cfg so Spyder/PEP8 will recognize my new limit? Or is there an other way to set this limit or to ignore E501 (line to long)? Just setting "Show vertical line after 99 characters" in Spyder does not help.

Answer

Carlos Cordoba picture Carlos Cordoba · Oct 18, 2014

According to the link cited by @Werner:

http://pep8.readthedocs.org/en/latest/intro.html#configuration

what you need to do is to create a file called ~/.config/pep8 (On Linux/Mac) or ~/.pep8 (on Windows), and add these lines to it:

[pep8]
max-line-length = 99

I tested it in Spyder and it works as expected.