[GRASS-SVN] r53783 - grass/trunk
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 13 03:42:43 PST 2012
Author: martinl
Date: 2012-11-13 03:42:42 -0800 (Tue, 13 Nov 2012)
New Revision: 53783
Modified:
grass/trunk/SUBMITTING_PYTHON
Log:
note Python pep08
Modified: grass/trunk/SUBMITTING_PYTHON
===================================================================
--- grass/trunk/SUBMITTING_PYTHON 2012-11-13 08:40:14 UTC (rev 53782)
+++ grass/trunk/SUBMITTING_PYTHON 2012-11-13 11:42:42 UTC (rev 53783)
@@ -8,6 +8,7 @@
[ see SUBMITTING for C hints ]
[ see SUBMITTING_DOCS for documentation ]
+See also http://www.python.org/dev/peps/pep-0008/
0. Indentation
@@ -19,10 +20,12 @@
See also "Python Style Guide" by Guido van Rossum
http://www.python.org/doc/essays/styleguide.html
+
1. Instructions for the GRASS script parser can be found in the g.parser
module's help page.
http://grass.osgeo.org/grass70/manuals/html70_user/g.parser.html
+
2. Use the directory structure to place your script appropriately into
the source tree
- scripts go into scripts/
@@ -30,6 +33,7 @@
Also add a Makefile and a <module>.html file into this directory.
See existing Python scripts for examples.
+
3. Add a header section to the script you submit and make sure you
include the copyright. The purpose section is meant to contain a
general over view of the code in the file to assist other
@@ -64,9 +68,11 @@
Just select an existing module which is close to your application to save
efforts.
+
4. We don't want the $ ID $ in source code any more as it causes problems
for the branches.
+
5. Create and use secure temporary files and directories. Use the
grass.tempfile() or grass.tempdir() functions to do this. e.g.
@@ -75,6 +81,7 @@
if TMP is None:
grass.fatal("Unable to create temporary files")
+
6. Use grass.findfile() when there is a need to test if a map exists.
# test for input raster map
@@ -111,6 +118,7 @@
Try to omit any usage of the 'print' command for informational output.
+
8. PLEASE take the time to add comments throughout your code explaining what
the code is doing. It will save a HUGE amount of time and frustration for
other programmers that may have to change your code in the future.
More information about the grass-commit
mailing list