7

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.

modulitos
  • 2,482
  • 1
  • 22
  • 37
  • I suspect you want fill-column. – Dan Jun 13 '16 at 01: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 03: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 https://flake8.readthedocs.io/en/latest/config.html – Jules Jun 13 '16 at 14:36

1 Answers1

9

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.pycqa.org/en/latest/user/configuration.html#user-configuration

Chillar Anand
  • 4,102
  • 1
  • 24
  • 52