Style analysis (pep8) max line length

1,781 views
Skip to first unread message

Alexey Orlov

unread,
Dec 29, 2014, 7:04:43 AM12/29/14
to spyd...@googlegroups.com
Hi,

I'm trying to relax the 79 character line limit. Changed Preferences->Editor->Display->Show vertical line after to 159: still getting warnings like "E501 line too long (120 > 79 characters)". Am I missing something?

Adrian Klaver

unread,
Dec 29, 2014, 5:15:05 PM12/29/14
to spyd...@googlegroups.com
On 12/29/2014 04:04 AM, Alexey Orlov wrote:
> Hi,
>
> I'm trying to relax the 79 character line limit. Changed
> /Preferences->Editor->Display->Show vertical line after/ to 159: still
> getting warnings like "E501 line too long (120 > 79 characters)". Am I
> missing something?

Yes that is coming from the pep8 tool and is correct. According to PEP8
line > 79 characters are incorrect. Setting the vertical line is just a
feature in the editor and not a change in the PEP8 style guide. If you
do not want to see this, turn off Style Analysis in
Tools-->Editor-->Code Introspection/Analysis.

You might something in the pep8 docs that allows you to change the line
setting:

http://pep8.readthedocs.org/en/latest/
>
> --
> You received this message because you are subscribed to the Google
> Groups "spyder" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to spyderlib+...@googlegroups.com
> <mailto:spyderlib+...@googlegroups.com>.
> To post to this group, send email to spyd...@googlegroups.com
> <mailto:spyd...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/spyderlib.
> For more options, visit https://groups.google.com/d/optout.


--
Adrian Klaver
adrian...@aklaver.com

Alexey Orlov

unread,
Dec 29, 2014, 5:31:39 PM12/29/14
to spyd...@googlegroups.com
This is from pep8 --help output:

  --max-line-length=n  set maximum allowed line length (default: 79)

There must be a way to set it for Spyder 

Adrian Klaver

unread,
Dec 29, 2014, 5:40:54 PM12/29/14
to spyd...@googlegroups.com
On 12/29/2014 02:31 PM, Alexey Orlov wrote:
> This is from *pep8 --help* output:
>
> *--max-line-length=n set maximum allowed line length (default: 79)*
>
> There must be a way to set it for Spyder

Not that I know of in Spyder. It seems though you can create a conf file
for pep8, where you can change its behavior:

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


--
Adrian Klaver
adrian...@aklaver.com

Alexey Orlov

unread,
Dec 29, 2014, 11:39:55 PM12/29/14
to spyd...@googlegroups.com
Not that I know of in Spyder. It seems though you can create a conf file
for pep8, where you can change its behavior:

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

Thanks, Adrian! Should have read the FM myself. Shame on me. 

Joseph Martinot-Lagarde

unread,
Dec 30, 2014, 12:03:41 PM12/30/14
to spyd...@googlegroups.com
This option could be set using the config value in spyder, this would be
a nice addition.

Joseph

Adrian Klaver

unread,
Dec 30, 2014, 1:03:01 PM12/30/14
to spyd...@googlegroups.com
Why?

pep8 is an external program the user chooses to enable. What you want to
do in Spyder may or not have anything to do with what you do outside
Spyder. Having Spyder set the option in a pep8 conf file would make it
apply to all cases. Not sure that is desirable. Now I could see offering
a way for pep8 to read a Spyder specific conf file:

http://pep8.readthedocs.org/en/latest/intro.html#example-usage-and-output

--config=path user config file location (default: ~/.config/pep8)

>
> Joseph
>


--
Adrian Klaver
adrian...@aklaver.com

Gonzalo A. PEÑA CASTELLANOS

unread,
Dec 30, 2014, 1:14:08 PM12/30/14
to spyd...@googlegroups.com
Not sure how pep8 is executed in spyder right now, but it is probably being called in a QProcess or similar.

If this is the case then we should simply pass this argument to the QProcess command list

--max-line-length=n  set maximum allowed line length (default: 79)

And it would only affect pep8 when being executed on spyder, and no conf would be created

Should be doable and a nice addition I think

Cheers

Adrian Klaver

unread,
Dec 30, 2014, 1:48:57 PM12/30/14
to spyd...@googlegroups.com
On 12/30/2014 10:14 AM, Gonzalo A. PEÑA CASTELLANOS wrote:
> Not sure how pep8 is executed in spyder right now, but it is probably
> being called in a QProcess or similar.
>
> If this is the case then we should simply pass this argument to the
> QProcess command list
> *
> *
> *--max-line-length=n set maximum allowed line length (default: 79)*
>
> And it would only affect pep8 when being executed on spyder, and no conf
> would be created
>
> Should be doable and a nice addition I think

Agreed, but what happens when someone wants to change tabs settings?

Basically this means anytime a pep8 element is exposed in Spyder a
change needs to be made. Seems saner to just point to a single conf file
and let the end user decide how they want to tweak PEP8.

>
> Cheers

Joseph Martinot-Lagarde

unread,
Dec 30, 2014, 6:35:24 PM12/30/14
to spyd...@googlegroups.com
Le 30/12/2014 19:48, Adrian Klaver a écrit :
> On 12/30/2014 10:14 AM, Gonzalo A. PEÑA CASTELLANOS wrote:
>> Not sure how pep8 is executed in spyder right now, but it is probably
>> being called in a QProcess or similar.
>>
>> If this is the case then we should simply pass this argument to the
>> QProcess command list
>> *
>> *
>> *--max-line-length=n set maximum allowed line length (default: 79)*
>>
>> And it would only affect pep8 when being executed on spyder, and no conf
>> would be created
>>
>> Should be doable and a nice addition I think
>
> Agreed, but what happens when someone wants to change tabs settings?
>
> Basically this means anytime a pep8 element is exposed in Spyder a
> change needs to be made. Seems saner to just point to a single conf file
> and let the end user decide how they want to tweak PEP8.
That's true for advanced end-users. Some people would just like that "it
works".
Spyder could try to override this value only if no config file for pep8
is present. Or make the command line configurable, and by default use
the value from spyder's configuration.

Adrian Klaver

unread,
Dec 30, 2014, 6:50:56 PM12/30/14
to spyd...@googlegroups.com
On 12/30/2014 03:35 PM, Joseph Martinot-Lagarde wrote:
> Le 30/12/2014 19:48, Adrian Klaver a écrit :
>> On 12/30/2014 10:14 AM, Gonzalo A. PEÑA CASTELLANOS wrote:
>>> Not sure how pep8 is executed in spyder right now, but it is probably
>>> being called in a QProcess or similar.
>>>
>>> If this is the case then we should simply pass this argument to the
>>> QProcess command list
>>> *
>>> *
>>> *--max-line-length=n set maximum allowed line length (default: 79)*
>>>
>>> And it would only affect pep8 when being executed on spyder, and no conf
>>> would be created
>>>
>>> Should be doable and a nice addition I think
>>
>> Agreed, but what happens when someone wants to change tabs settings?
>>
>> Basically this means anytime a pep8 element is exposed in Spyder a
>> change needs to be made. Seems saner to just point to a single conf file
>> and let the end user decide how they want to tweak PEP8.
> That's true for advanced end-users. Some people would just like that "it
> works".
> Spyder could try to override this value only if no config file for pep8
> is present. Or make the command line configurable, and by default use
> the value from spyder's configuration.

And the code paths multiply:) The way I see it, if you are not an
advanced user you use PEP8 as is. If you do not agree you are advanced
user and you tinker as you see fit. Though in the end I do not have to
support the code so it really does not matter what direction this takes.

>
>>
>>>
>>> Cheers
>>>


--
Adrian Klaver
adrian...@aklaver.com

Gonzalo A. PEÑA CASTELLANOS

unread,
Jan 2, 2015, 8:12:07 AM1/2/15
to spyd...@googlegroups.com
Hi Adrian it is a good point the one you make, but perhaps it is time to consider how this is handled by Spyder...

I think we could add an 'override pep8 settings' option by Spyder settings where they apply. I do not think they are so many options that we can not handle it in an efficient way.

So if you want to change some stuff and want pep8 to follow this setting you modified manually in the preferences then clicking on this new option should do the trick

Happy new year!

Carlos Córdoba

unread,
Jan 4, 2015, 4:27:58 PM1/4/15
to spyd...@googlegroups.com
Hi,

I think it'd be really nice to combine the max line width setting of pep8 with our current setting, so users don't see the current pep8 warning (as I think the OP was saying). Pull requests are always welcome (and this one seems really easy too). But wait until we move to Github (hopefully by the end of this week).

Cheers,
Carlos

El 02/01/15 a las 08:12, Gonzalo A. PEÑA CASTELLANOS escribió:
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+...@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages