[libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

Andrea Bolognani abologna at redhat.com
Thu Sep 12 10:56:04 UTC 2019


On Thu, 2019-09-12 at 11:13 +0100, Daniel P. Berrangé wrote:
> On Thu, Sep 12, 2019 at 05:55:38PM +0800, Shi Lei wrote:
> > +AC_PATH_PROG([PEP8], [pep8])
> > +if test -z "$PEP8"; then
> > +    AC_MSG_ERROR(['pep8' binary is required to check python code style])
> > +fi
> 
> Using pep8 is an interesting idea. Especially with my series to
> standardize on using python for all build scripts, it will be
> valuable to have much more advanced python style checks.
> 
> The only thing I wonder about is whether its reasonable to make
> it a mandatory requirement or not, since it is a separate package
> from python itself we can't assume it is present I think. It is
> on the various Linux we care about and FreeBSD too, but I'm not
> seeing it for macOS via homebrew.
> 
> Also on my host 'pep8' is a python2 impl, you need 'pep8-3' for
> the python3 impl. Except that when I run it, it warns that
> it is renamed to pycodestyle upstream and 'pep8' will be dropped
> in future.
> 
> IOW, I think we'll need to check for existence of the first available
> bniary from the list in this order:
> 
>   pycodestyle-3 pycodestyle pycodestyle-2 pep8-3 pep8 pep8-2

FWIW, libvirt-dbus is using flake8 to achieve what I believe is
basically the same result, whereas virt-manager I think uses pylint
and pycodestlye.

I am not familiar enough with the Python ecosystem to be able to
compare the various linters, but it would IMHO make sense to at
least try to standardize on one or more of them and use them across
libvirt-related projects.

CC'ing Cole and Pavel, who as maintainers of the biggest chunk of
Python code in the entire stack can probably offer some useful
insights.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list