Re: [Qgis-developer] Python plugins style guide

2010-12-28 Thread Martin Dobias
On Sun, Dec 26, 2010 at 12:27 AM, Ricardo Filipe Soares Garcia da
 wrote:
> Hi list
>
> I have been working with Luiz Motta in the 'Custom db query' plugin
> and we came about the dilemma of how to best format our Python code.
>
> Looking around the QGIS wiki, we found the developers manual [1] and
> read through the coding guidelines, but the rules defined in it are
> for C++ programming and for QGIS core. We couldn't find anything
> related to Python and plugins.
>
> Has this been debated in the past? Is there a recommended style for
> formatting Python code in QGIS plugins?
> I usually follow the recommendation in the PEP8 [2], the official
> style guide for Python. But Luiz argues (a valid point I guess) that
> if we were to follow the C++ standard it would be more consistent with
> the rest of the code.

Hi Ricardo

I would recommend to use the Python style guide for plugins code.
After all, our c++ style cannot be applied in many cases, for example,
where to put opening and closing braces or naming of member variables
(mFoo in c++, naturally self.foo in python).

Also PyQt4 authors tend to "pythonize" the api, AFAIK pyqt for python3
will automatically convert QString to python (unicode) strings etc. Of
course there is a doubt whether to use Qt or python library for some
functionality found in both. This is just a matter of taste and
personally I would choose python library because typically it's less
verbose and more elegant.

Regards
Martin
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Python plugins style guide

2010-12-25 Thread Luiz Motta
The choice about your style depend how you use the tecnology.

At moment, i am migrating for consume of Qt Framework, then, i prefer use
the classes of Qt than Python with the same funcionality, of course, the
code style is closer of QGIS developers.

It is good we has one guide, or one manual of good practices , to plugin in
Python,  facilitating the construction of several persons plugin.

My opinion is use the PyQt4 style, it is more close of QGIS developers.
It is more easy migrate to C++  candidate's  plugins to core

Regards,
Luiz

2010/12/25 Stefan Keller 

> My recommendation is:
>
> 1. Be consistent using whatever style.
> 2. I would prefer Python style (PEP), since Python is read by Python
> programmers and has it's own block style.
>
> Yours, S.
>
> 2010/12/26 Ricardo Filipe Soares Garcia da  >:
> > Hi list
> >
> > I have been working with Luiz Motta in the 'Custom db query' plugin
> > and we came about the dilemma of how to best format our Python code.
> >
> > Looking around the QGIS wiki, we found the developers manual [1] and
> > read through the coding guidelines, but the rules defined in it are
> > for C++ programming and for QGIS core. We couldn't find anything
> > related to Python and plugins.
> >
> > Has this been debated in the past? Is there a recommended style for
> > formatting Python code in QGIS plugins?
> > I usually follow the recommendation in the PEP8 [2], the official
> > style guide for Python. But Luiz argues (a valid point I guess) that
> > if we were to follow the C++ standard it would be more consistent with
> > the rest of the code.
> >
> > I guess we are in a state where I have my opinion, he has his own, and
> > we'd like to reach a consensus by surveying your thoughts on this
> > subject. Also it seems like a good idea to raise this issue now, with
> > the upcoming possibility of having multiple people collaborating on
> > plugins.
> >
> > Thanks
> >
> > [1] - http://www.qgis.org/wiki/Developers_Manual
> > [2] - http://www.python.org/dev/peps/pep-0008/
> >
> > --
> > ___ ___ __
> > Ricardo Garcia Silva
> > ___
> > Qgis-developer mailing list
> > Qgis-developer@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Python plugins style guide

2010-12-25 Thread Stefan Keller
My recommendation is:

1. Be consistent using whatever style.
2. I would prefer Python style (PEP), since Python is read by Python
programmers and has it's own block style.

Yours, S.

2010/12/26 Ricardo Filipe Soares Garcia da :
> Hi list
>
> I have been working with Luiz Motta in the 'Custom db query' plugin
> and we came about the dilemma of how to best format our Python code.
>
> Looking around the QGIS wiki, we found the developers manual [1] and
> read through the coding guidelines, but the rules defined in it are
> for C++ programming and for QGIS core. We couldn't find anything
> related to Python and plugins.
>
> Has this been debated in the past? Is there a recommended style for
> formatting Python code in QGIS plugins?
> I usually follow the recommendation in the PEP8 [2], the official
> style guide for Python. But Luiz argues (a valid point I guess) that
> if we were to follow the C++ standard it would be more consistent with
> the rest of the code.
>
> I guess we are in a state where I have my opinion, he has his own, and
> we'd like to reach a consensus by surveying your thoughts on this
> subject. Also it seems like a good idea to raise this issue now, with
> the upcoming possibility of having multiple people collaborating on
> plugins.
>
> Thanks
>
> [1] - http://www.qgis.org/wiki/Developers_Manual
> [2] - http://www.python.org/dev/peps/pep-0008/
>
> --
> ___ ___ __
> Ricardo Garcia Silva
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Python plugins style guide

2010-12-25 Thread Ricardo Filipe Soares Garcia da
Hi list

I have been working with Luiz Motta in the 'Custom db query' plugin
and we came about the dilemma of how to best format our Python code.

Looking around the QGIS wiki, we found the developers manual [1] and
read through the coding guidelines, but the rules defined in it are
for C++ programming and for QGIS core. We couldn't find anything
related to Python and plugins.

Has this been debated in the past? Is there a recommended style for
formatting Python code in QGIS plugins?
I usually follow the recommendation in the PEP8 [2], the official
style guide for Python. But Luiz argues (a valid point I guess) that
if we were to follow the C++ standard it would be more consistent with
the rest of the code.

I guess we are in a state where I have my opinion, he has his own, and
we'd like to reach a consensus by surveying your thoughts on this
subject. Also it seems like a good idea to raise this issue now, with
the upcoming possibility of having multiple people collaborating on
plugins.

Thanks

[1] - http://www.qgis.org/wiki/Developers_Manual
[2] - http://www.python.org/dev/peps/pep-0008/

-- 
___ ___ __
Ricardo Garcia Silva
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer