[Qgis-developer] Python coding style for QGIS

Tim Sutton lists at linfiniti.com
Tue May 1 03:15:58 EDT 2012


Hi

On Tue, May 1, 2012 at 7:42 AM, Alexander Bruy <alexander.bruy at gmail.com> wrote:
> Hi all,
>
> we already have coding style for QGIS C++ code [0]. But in QGIS core
> there are also several Python plugins which have a different coding style.
> I think we need to create coding style for Python code included in master
> and reformat existing code to comply with this style.
>
> There is a PEP-0008 [1], an official Python style guide, not sure if we
> should use it as is. Maybe it is better to adopt it a bit and make more
> consistent with our C++ coding style.
>
> [0] https://github.com/qgis/Quantum-GIS/blob/master/CODING
> [1] http://www.python.org/dev/peps/pep-0008/
>

I would suggest that we use PEP8 - many editors will parse this and
there are checking tools that can be run from the command line. I
would also suggest we use 4 space indents so we can process code using
pyindent. I know it isnt very consistent with QGIS C++ coding standard
but many python coders are used to these standards and they are easy
to check and enforce.

I think it would be great to extend our CODING doc to include python
guidelines. I have already worked on similar guidelines for another
project [1] which we could easily adapt.

[1] http://inasafe.readthedocs.org/en/latest/developer-docs/coding_standards.html#coding-standards

Regards

Tim

> --
> Alexander Bruy
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================


More information about the Qgis-developer mailing list