[GRASS-dev] External python modules in scripts
wenzeslaus at gmail.com
Mon Sep 30 07:26:59 PDT 2013
you can use 3rd party Python packages/modules. numpy is even a standard
For extensions (GRASS modules) contributed to GRASS Addons it in best to
just write into the code and documentation what is required (and maybe
include also suggestion how to install these dependencies on different
The problem is when the module is included into trunk (i.e. the main
1) we need to add a new dependency (e.g. case of numpy or PIL) or
2) we need to include 3rd party library into the source code (e.g.
PyDispatcher and perhaps also ctypes) or
3) you can enable the functionality on runtime which usually means that you
just leave everything on the user and you just check if the import was
successful (by try-except block) and report that this and this needs to be
installed and than exit (using fatal_error function); in GUI this is used
for visvis library which enables additional export options in
g.gui.animation, in this there is a label in the interface which says that
you should install visvis.
Each of this options has some drawbacks...
Small methods/functions can be copied (and modified) if you need just some
limited part of 3rd party library functionality. Do not forget to put the
reference to the original code and authors into the source code for further
reference (and because of copyright/authorship).
License of 3rd party library should always be considered but since most of
the libraries are licensed under 'GPL 2 or higher' (same as grass) or some
more permissive licence (MIT style, new BSD, LGPL) it is usually not an
I hope that other developers agree at least to certain extend. Actually, I
don't know if something like this is specified somewhere but it
definitively should be.
On Sat, Sep 28, 2013 at 6:23 AM, Nick Ves <vesnikos at gmail.com> wrote:
> It's acceptable to use external python mobules (popular ones like scipy,
> numpy) if you want to contribute a script?
> Or you have to be 'purist' by either invoking grass commands through
> pygrass or re-writing methods found in 3d-party modules?
> grass-dev mailing list
> grass-dev at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-dev