[openstack-dev] flake8 magic you should all know

Monty Taylor mordred at inaugust.com
Mon May 20 00:00:46 UTC 2013



On 05/19/2013 01:34 AM, Melanie Witt wrote:
> On May 18, 2013, at 8:18 PM, "Monty Taylor" <mordred at inaugust.com
> <mailto:mordred at inaugust.com>> wrote:
>>
>>
>> On 05/18/2013 11:09 AM, Melanie Witt wrote:
>>> Hi Monty,
>>>
>>> Thanks for sending this out.
>>>
>>> I picked up this update and had a couple of minor issues.
>>
>> Which project?
> 
> Sorry, I forgot to mention I'm working with nova.
> 
>>> 1. It broke run_tests.sh, which I know there's been talk of not
>>> supporting going forward but just to let you know. I was able to run
>>> tox instead with success.
>>
>> The ones where it broke run_tests.sh are bugs. I think that should be
>> fixed across the board now - but if it's still broken, please let me know.
>>
>> It's also an easy patch to run_tests.sh - take the contents of
>> run_pep8() function in the script and simply replace it with ${wrapper}
>> flake8  - because it'll pull the config in.
> 
> Ok, thanks. In nova/run_tests.sh it wants to run tools/run_pep8.sh which
> has been removed.

https://review.openstack.org/29726 submitted.

>>> 2. If I don't have python2.7 installed, I need to add importlib to
>>> tools/test-requires to get it installed in the venv.
>>
>> That seems like a bug in general in the test-requires (or the pip
>> requires- OR - oh, are you saying that flake8 itself on python2.6 is
>> missing importlib? I think you are. Ok. I think I can fix that in
>> hacking - thanks!)
> 
> Well, it's that importlib is part of the standard library in python2.7
> but not python2.6. I'm not sure how this could be handled, I had found
> this: http://stackoverflow.com/questions/9418064/conditionally-installing-importlib-on-python2-6

Sigh. I'll sort something out...

>>> Melanie
>>>
>>> On May 16, 2013, at 7:29 PM, "Monty Taylor" <mordred at inaugust.com
>>> <mailto:mordred at inaugust.com>>
>>> wrote:
>>>
>>>> Hey all!
>>>>
>>>> As you have all probably noticed, we're moving to using flake8 to
>>>> run pep8/pyflakes/hacking checks. It's awesome and fills the worlds
>>>> with magical ponies and flying cars. BUT - I realized that it's
>>>> possible that perhaps people don't read all of the documentation
>>>> for everything. So I wanted to share a quick trick.
>>>>
>>>> flake8, in a fit of amazingness normally not found in python
>>>> utilities, knows how to read other people's config files. So - it
>>>> actually reads the config section in tox.ini even when it's not in
>>>> a venv. That means that, if your project has migrated to flake8
>>>> (that's most of you now) just running:
>>>>
>>>> flake8
>>>>
>>>> Will get you a flake8 run with all the right options and includes
>>>> and excludes and everything. No wrapper scripts, no fake meat -
>>>> only pure bacon. (you have to have flake8 installed, natch)
>>>>
>>>> Your friendly infra guy...
>>>>
>>>> Monty
>>>>
>>>> _______________________________________________ OpenStack-dev
>>>> mailing list OpenStack-dev at lists.openstack.org
>>>> <mailto:OpenStack-dev at lists.openstack.org>
>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>>
>>> _______________________________________________ OpenStack-dev mailing
>>> list OpenStack-dev at lists.openstack.org
>>> <mailto:OpenStack-dev at lists.openstack.org>
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> <mailto:OpenStack-dev at lists.openstack.org>
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 



More information about the OpenStack-dev mailing list