[code-quality] pep8 / flake8 config files.

Ian Lee ianlee1521 at gmail.com
Wed Mar 18 07:11:03 CET 2015


Not that early here either, so I could also be confusing myself, but I
don't think this is an issue.

flake8 uses the flake8.engine.get_style_guide() function [1] which takes in
``config_file=DEFAULT_CONFIG`` in just about every place it's called (e.g.
[2]) which in pep8 gets passed explicitly to ``process_options()``[3] with
the value that is set in ``pep8.StyleGuide.__init__()`` [4]

[1] https://gitlab.com/pycqa/flake8/blob/master/flake8/engine.py#L107
[2] https://gitlab.com/pycqa/flake8/blob/master/flake8/main.py#L24
[3] https://github.com/jcrocholl/pep8/blob/master/pep8.py#L1787-L1788
[4] https://github.com/jcrocholl/pep8/blob/master/pep8.py#L1782


~ Ian Lee

On Tue, Mar 17, 2015 at 11:00 PM, Ian Cordasco <graffatcolmingov at gmail.com>
wrote:

>
>
> On Wed, Mar 18, 2015 at 12:50 AM, Ian Lee <ianlee1521 at gmail.com> wrote:
>
>> Yes, it wasn't an exact reversion of just that change (though perhaps
>> that would be a better way to go about it).
>>
>> The logic that you're looking for (if I'm reading this right) is that
>> last bit of the diff you posted (
>> https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987)
>> from lines (numbered off master) 2041 - 2101. Namely, the former assignment
>> of ``pep8style = StyleGuide(parse_argv=True, config_file=True)`` used to
>> take the config_file=True argument and then ``process_options(...)`` would
>> use that to set the config_file to DEFAULT_CONFIG (now named USER_CONFIG in
>> master).
>>
>> Does that clear up the piece that you were missing?
>>
>>
>> ~ Ian Lee
>>
>> On Tue, Mar 17, 2015 at 10:32 PM, Ian Cordasco <
>> graffatcolmingov at gmail.com> wrote:
>>
>>>
>>>
>>> On Wed, Mar 18, 2015 at 12:17 AM, Ian Lee <ianlee1521 at gmail.com> wrote:
>>>
>>>> Hi All --
>>>>
>>>> I just pushed a commit [1] to the pep8 repo that contains what I hope
>>>> is a fix for the issues with pep8 / flake8 config files that arose from the
>>>> way that pep8 #368 was handled, e.g. [2] (I think, I'm getting 500 errors
>>>> when I try to few issues on the flake8 repo, but I'm hoping that is
>>>> transient).
>>>>
>>>> This led to flake8 2.4.0 pinning to pep8 < 1.6 in it's latest release
>>>> [3].
>>>>
>>>> I'm hoping that folks can test out there configurations and ways of
>>>> running flake8 / pep8 with various configuration files (user and project
>>>> specific configs) and please report any issues to me.
>>>>
>>>> Thanks in advance!
>>>>
>>>> [1]
>>>> https://github.com/jcrocholl/pep8/commit/435d1cbf995a659a82d1d4b42d25e3459556ef21
>>>> [2] https://gitlab.com/pycqa/flake8/issues/35
>>>> [3] https://pypi.python.org/pypi/flake8/2.4.0
>>>>
>>>> ~ Ian Lee
>>>>
>>>> _______________________________________________
>>>> code-quality mailing list
>>>> code-quality at python.org
>>>> https://mail.python.org/mailman/listinfo/code-quality
>>>>
>>>>
>>> Hey Ian,
>>>
>>> Thanks for working on this. Looking at
>>> https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21
>>> it's not identical to 1.5.7. By default options.config_file was previously
>>> None. So the USER_CONFIG wasn't checked/loaded first (
>>> https://github.com/jcrocholl/pep8/compare/1.5.7...435d1cbf995a659a82d1d4b42d25e3459556ef21#diff-429d64b260de27fe3688921a1592b3f6R1987).
>>> Am I missing logic where options.config was changed to default to
>>> USER_CONFIG? (I know the binding was previously called user_conf, but I'm
>>> not entirely convinced this is doing the same thing in effect.)
>>>
>>> Cheers,
>>> Ian
>>>
>>
>>
> So it looks like the SyleGuide's API has changed in a fairly significant
> way then, no? Users aren't expected to pass `config_file=True` now? This
> means the next release of flake8 will either need to specify a higher
> minimum version or conditionally handle how it creates the StyleGuide based
> on the version of pep8. It's late here and I'm tired though, so I could be
> wrong, but it seems like this is somewhat backwards incompatible.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20150317/d80a871f/attachment.html>


More information about the code-quality mailing list