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

此生再无相见时 提交于 2019-11-30 18:02:43

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.

Inspired by Minh's comment I've been able to make this work for spyder 3.8 by doing the following. Find out the ~ directory using

import os; os.path.expanduser('~')

(see remark ofJustin Harris)

Then add a file to the ~ directory called .pycodestyle containing:

[pycodestyle]
max-line-length = 99

(see Carlos Cordoba's answer)

Restart spyder [EDIT: according to the comments below this is not needed]. This is actually just combining most of the above remarks and answers.

References to "pep8" are obsolete. The package has been renamed to "pycodestyle".

The tox.ini with a pep8 section or a setup.cfg at the project level should do.

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

using the Spyder 4.0.0.dev0 went to my ~/.config/spyder.ini, ensured that my spyder application was not running change the dictionary value 'maxLineLength': 100 from 'maxLineLength': 79.

Started my app and it worked now if you edit the file while your spyder app is running upon shutting down it will overwrite what ever is in the ~/.config/spyder.ini.

Ensure it is not running and make the necessary changes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!