Why does PyCharm use 120 Character Lines even though PEP8 Specifies 79?
Solution 1:
PyCharm is built on top of IntelliJ. IntelliJ has a default line length of 120 characters.
This is probably because you can't fit a common Java name like: @annotated public static MyObjectFactoryFactory enterpriseObjectFactoryFactoryBuilderPattern {
in a mere 80 character line. (I'm poking fun, but Java names do tend to be longer by convention).
The pep8 checker is configurable, so you can specify a better max line length - like 79 characters.
The error is misleading because the pep8 checker formats the text with something like "PEP8: line too long(... > %s characters)" % max_line_setting
. So it's using the pep8 checker, with a specific configuration, not claiming that pep8 specifies a 120 character line.
Solution 2:
If you want to remove the limit warning altogether you can take the following steps:
- In PyCharm, click File > Settings
- In the project settings section, click Editor > Inspections
- In the list that appears, expand Python
- Under Python, scroll down and click "PEP8 coding style violation"
- Click the + button next to "Ignore errors" in the bottom right
- Type out E501 and click Apply and/or OK
Sources:
http://iambigblind.blogspot.com/2013/02/configuring-pep8py-support-in-pycharm-27.html
https://intellij-support.jetbrains.com/hc/en-us/community/posts/205816889-Disable-individual-PEP8-style-checking-line-length-