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 )
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.ovirt.org/61964
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,OVIRT_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.
It has also been proposed to reach consensus on isort configuration so all the python code
within ovirt project will have same styling.
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