2

I am using elpy for my Python development, but I would like to set the per-line character limit to 120 instead of the default 80 used by PEP8. Any suggestions on how I can do this? Even better, it would be great if I can customize this setting on a per-project basis.

I have tried the following:

  • M-x customize-group elpy
  • M-x customize-mode elpy-mode
  • M-x customize-mode python-mode

but I can't seem to find the option that customizes the line character limit.

  • I suspect you want fill-column. – Dan Jun 13 '16 at 1:13
  • @Dan can you elaborate a bit? I tried setting fill-column (M-x set-fill-column and via M-x customize-variable fill-column), but elpy still shows an error for lines longer than 79 characters, with the message E501 line too long (81 > 79 characters). I tried refreshing the buffer too, but no luck. Any suggestions? – modulitos Jun 13 '16 at 3:41
  • This seems like something that needs to be set through the flake8 config file or through the autopep8 config file depending on what you want. Take a look at the configuration page flake8.readthedocs.io/en/latest/config.html – Jules Jun 13 '16 at 14:36
4

If you want to customize per project basis, you can create a setup.cfg with custom config like this

[flake8]
max-line-length = 160

If you want to change this globally, you can change flake8 config as mentioned here https://flake8.readthedocs.io/en/latest/config.html#global

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.