[ovirt-devel] Python code style: introducing isort

Sandro Bonazzola sbonazzo at redhat.com
Fri Aug 26 13:19:17 UTC 2016


On Thu, Aug 18, 2016 at 4:54 PM, Sandro Bonazzola <sbonazzo at redhat.com>
wrote:

>
>
> On Tue, Aug 9, 2016 at 12:36 PM, Eyal Edri <eedri at redhat.com> wrote:
>
>> Adding infra also, as might be relevant for our code.
>>
>> On Tue, Aug 9, 2016 at 11:06 AM, Sandro Bonazzola <sbonazzo at redhat.com>
>> wrote:
>>
>>> Hi,
>>> in project maintained by integration team we tried to adhere to some
>>> styling rules while writing python code, one of these was related to the
>>> import lines. After a lot of time doing this manually, we discovered isort
>>> ( https://pypi.python.org/pypi/isort/4.2.5 )
>>>
>>>
> Available in fedora 24 updates-testing as python-isort, should land to
> stable pretty soon.
>
>
>
>> We're using it before we push our code to gerrit and a few days ago I
>>> sent a patch for the python code within ovirt-engine: https://gerrit.o
>>> virt.org/61964
>>>
>>
> Going to merge this tomorrow.
>
>
>
>>
>>> The configuration we're currently using is:
>>>
>>> $ cat ~/.isort.cfg [settings] line_length=79
>>> known_standard_library=configparser,Cheetah.Template
>>> force_single_line=True default_section=FIRSTPARTY known_otopi=otopi
>>> known_host_deploy=ovirt_host_deploy known_ovirt_engine=ovirt_engine
>>> known_ovirt_engine_setup=ovirt_engine_setup
>>> known_ovirt_setup_lib=ovirt_setup_lib known_vdsm=vdsm
>>> known_ovirt_hosted_engine_setup=ovirt_hosted_engine_setup
>>> sections=FUTURE,STDLIB,FIRSTPARTY,OTOPI,VDSM,HOST_DEPLOY,OVI
>>> RT_ENGINE,OVIRT_ENGINE_SETUP,OVIRT_SETUP_LIB,OVIRT_HOSTED_
>>> ENGINE_SETUP,THIRDPARTY,LOCALFOLDER lines_between_types=2
>>>
>>> It has been proposed to add 'isort --check-only' in check-patch.for
>>> python projects in addition to pep8 style checking.
>>>
>>
>
> No objections, I take this as approved. Opening a ticket.
>

isort --check-only has been added to ovirt-engine check-patch.
Please be sure to rebase your patch if it fails complaining about incorrect
ordering of imports



>
>
>>
>>> It has also been proposed to reach consensus on isort configuration so
>>> all the python code
>>> within ovirt project will have same styling.
>>>
>>
> No suggestions, I take proposed config as approved as a start. We can
> amend it later on.
>
>
>>
>>> I'd like to get some feedback about these proposal in order to decide
>>> how to procede.
>>>
>>> Thanks,
>>>
>>> --
>>> Sandro Bonazzola
>>> Better technology. Faster innovation. Powered by community collaboration.
>>> See how it works at redhat.com
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> Devel at ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/devel
>>>
>>
>>
>>
>> --
>> Eyal Edri
>> Associate Manager
>> RHV DevOps
>> EMEA ENG Virtualization R&D
>> Red Hat Israel
>>
>> phone: +972-9-7692018
>> irc: eedri (on #tlv #rhev-dev #rhev-integ)
>>
>
>
>
> --
> Sandro Bonazzola
> Better technology. Faster innovation. Powered by community collaboration.
> See how it works at redhat.com
>



-- 
Sandro Bonazzola
Better technology. Faster innovation. Powered by community collaboration.
See how it works at redhat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/infra/attachments/20160826/7fc75854/attachment.html>


More information about the Infra mailing list