Hi,
I would like to know if geany supports [1] plugin creation using python [2] dynamic loading of plugins without re-compiling it from sources.
-Shiv
On Tue, Mar 18, 2008 at 2:12 PM, Frank Lanitz frank@frank.uvena.de wrote:
On Tue, March 18, 2008 7:43 am, S h i v wrote:
I would like to know if geany supports [1] plugin creation using python
Not yet, unfortunaly.
[2] dynamic loading of plugins without re-compiling it from sources.
What do you understand with this?
Two possibilities: 1. I create a shared object and put it under plugins directory and it gets loaded the next geany is opened. 2. Still better, I write the plugins using scriting language such as python in a way geany expects and place it under plugins directory and the next time geany is opened, it loads the plugin.
The advantage of supporting a scripting language is the ease of development/contribution. Plugins being non-core components can afford the small overhead of slower execution I suppose.
Anyway, if thought useful, would like to request this as a feature for future support.
regards Shiv
S h i v shivakumar.gn@gmail.com wrote:
Two possibilities:
- I create a shared object and put it under plugins
directory and it gets loaded the next geany is opened.
Already possible, see HACKING file in the Geany sources.
- Still better, I write the plugins using scriting
language such as python in a way geany expects and place it under plugins directory and the next time geany is opened, it loads the plugin.
It is possible to write Lua scripts for Geany, using the GeanyLua plugin from: http://yetanothergeek.justfree.com/geanylua
Python support has been discussed here before, but as far as I know, nobody is currently working on it.
- Jeff
On Tue, 18 Mar 2008 07:30:53 -0500 "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
S h i v shivakumar.gn@gmail.com wrote:
- Still better, I write the plugins using scriting
language such as python in a way geany expects and place it under plugins directory and the next time geany is opened, it loads the plugin.
It is possible to write Lua scripts for Geany, using the GeanyLua plugin from: http://yetanothergeek.justfree.com/geanylua
Python support has been discussed here before, but as far as I know, nobody is currently working on it.
I just changed the TODO wishlist item for Python scripting to 'Python plugin interface' - IMO there's no need for a competing Python variant of your great Lua plugin. It would be more useful to have Python bindings for the plugin API, so plugins could be written in Python instead of C. This would be harder to write than a Lua user 'script' but would also be more flexible, if it used pygtk. Of course this is only a wishlist item, don't anyone expect it to get done ;-)
Regards, Nick
Nick Treleaven nick.treleaven@btinternet.com wrote:
I just changed the TODO wishlist item for Python scripting to 'Python plugin interface' - IMO there's no need for a ... It would be more useful to have Python bindings for the plugin API, so plugins could be written in Python instead of C. ... Of course this is only a wishlist item, don't anyone expect it to get done ;-)
hehe, maybe this could be a start...
It generates 100k+ lines of C code and about 5300 lines of python, along with a shared lib - but I have no clue what to do with it!
###################################
#!/bin/bash
OUT_DIR=$HOME/geanypy GEANY_INC=/usr/local/include/geany
swig -version > /dev/null || exit gawk --version > /dev/null || exit gcc --version > /dev/null || exit python-config --libs > /dev/null || exit pkg-config --print-errors geany || exit
mkdir -p $OUT_DIR || exit cd $OUT_DIR || exit
for H in $(find $GEANY_INC -type f -name '*.h') do M="$(basename $H .h)" C="./$M.c" I="./$M.i" echo "%module $M %{ #include "Scintilla.h" #include "geany.h" #include "$H" %} " > $I gawk '{ gsub(/<G_GNUC_NULL_TERMINATED.*;/,";"); gsub(/<G_GNUC_PRINTF.*;/,";"); print }' $H >> $I echo "Generating module "$M"" swig -python $(pkg-config --cflags geany) -o $C $I echo "Compiling "$M"" gcc -c $(pkg-config --cflags geany) \ $(python-config --includes) $C done echo echo "Lines per module:" wc -l *.py echo echo "Creating shared lib:" gcc -shared *.o -o libgeanypy.so ls -lh $PWD/libgeanypy.so echo echo "done."
###################################
- Jeff
On Thu, 20 Mar 2008 15:17:15 -0500 "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
Nick Treleaven nick.treleaven@btinternet.com wrote:
It would be more useful to have Python bindings for the plugin API, so plugins could be written in Python instead of C.
hehe, maybe this could be a start...
It generates 100k+ lines of C code and about 5300 lines of python, along with a shared lib - but I have no clue what to do with it!
Thanks, this looks great, but I haven't been able to test it.
Unfortunately I can't seem to get python-config installed (on Fedora 5, Python 2.4). Fedora seems to have no package for it until v7 or later, when it's included with Python. So I tried downloading it from: http://www.red-dove.com/python_config.html
But I'm not sure this is what I need. I installed it with: python setup.py install
But that just installed a config.py module, which doesn't seem to be what I want (it ignores --libs, etc).
Anyway, I'll try to test the script on a more recent distro soon.
Regards, Nick
Nick Treleaven nick.treleaven@btinternet.com wrote:
Unfortunately I can't seem to get python-config installed (on Fedora 5, Python 2.4). Fedora seems to have no package for it until v7 or later, when it's included with Python. So I tried downloading it from:
I don't know about Fedora, but for OpenSuSE-10.3/Python-2.5 it is in the "python-devel" package.
- Jeff
Am Freitag, den 21.03.2008, 12:54 -0500 schrieb Jeff Pohlmeyer:
Nick Treleaven nick.treleaven@btinternet.com wrote:
Unfortunately I can't seem to get python-config installed (on Fedora 5, Python 2.4). Fedora seems to have no package for it until v7 or later, when it's included with Python. So I tried downloading it from:
I don't know about Fedora, but for OpenSuSE-10.3/Python-2.5 it is in the "python-devel" package.
For my Fedora 8-System its python:
$ rpm -qf `which python-config` python-2.5.1-15.fc8
But i don't know how this is on Fedora 5...
- Jeff
Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
As far as this script is concerned, you could probably do without it it, provided you at least have the Python headers installed.
Just remove the line that says: python-config --libs > /dev/null || exit
And then change: $(python-config --includes)
To something like this: -I/usr/include/python2.4
- Jeff
On Fri, 21 Mar 2008 12:54:00 -0500 "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
Nick Treleaven nick.treleaven@btinternet.com wrote:
Unfortunately I can't seem to get python-config installed (on Fedora 5, Python 2.4). Fedora seems to have no package for it until v7 or later, when it's included with Python. So I tried downloading it from:
I don't know about Fedora, but for OpenSuSE-10.3/Python-2.5 it is in the "python-devel" package.
That seems a logical place for it, but alas on Fedora 5 no cigar. I have a laptop with Fedora 8 on it, I'll try that next week.
Regards, Nick
On Thu, Mar 20, 2008 at 12:29 PM, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Tue, 18 Mar 2008 07:30:53 -0500 "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
Python support has been discussed here before, but as far as I know, nobody is currently working on it.
I just changed the TODO wishlist item for Python scripting to 'Python plugin interface' - IMO there's no need for a competing Python variant of your great Lua plugin. It would be more useful to have Python bindings for the plugin API, so plugins could be written in Python instead of C. This would be harder to write than a Lua user 'script' but would also be more flexible, if it used pygtk. Of course this is only a wishlist item, don't anyone expect it to get done ;-)
Maybe have a look at the now-standard Python ctypes module.
* http://starship.python.net/crew/theller/ctypes/ * http://docs.python.org/lib/module-ctypes.html
Could be less work than you're expecting.
---John
On Fri, 21 Mar 2008 13:16:37 -0500 "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
As far as this script is concerned, you could probably do without it it, provided you at least have the Python headers installed.
Just remove the line that says: python-config --libs > /dev/null || exit
And then change: $(python-config --includes)
To something like this: -I/usr/include/python2.4
OK, thanks, this works. But (I assume) the generated bindings won't work, as swig probably expects the geany functions and global variables to be in a shared library. Also there would be problems with looking up plugin symbols from Geany, this would need to be coded specially. Still it's interesting anyway ;-)
Regards, Nick
On Fri, 21 Mar 2008 16:01:03 -0400 "John Gabriele" jmg3000@gmail.com wrote:
On Thu, Mar 20, 2008 at 12:29 PM, Nick Treleaven nick.treleaven@btinternet.com wrote:
I just changed the TODO wishlist item for Python scripting to 'Python plugin interface' - IMO there's no need for a competing Python variant of your great Lua plugin. It would be more useful to have Python bindings for the plugin API, so plugins could be written in Python instead of C. This would be harder to write than a Lua user 'script' but would also be more flexible, if it used pygtk. Of course this is only a wishlist item, don't anyone expect it to get done ;-)
Maybe have a look at the now-standard Python ctypes module.
Could be less work than you're expecting.
Thanks for this info. I think whichever automated generation approach is best, there will still be work to do in making it work with Geany, and I expect it would require changes to the plugin system. So I won't work on this for now.
Regards, Nick
On Mon, 24 Mar 2008 16:21:21 +0000 Nick Treleaven nick.treleaven@btinternet.com wrote:
On Fri, 21 Mar 2008 13:16:37 -0500 "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
Just remove the line that says: python-config --libs > /dev/null || exit
And then change: $(python-config --includes)
To something like this: -I/usr/include/python2.4
OK, thanks, this works. But (I assume) the generated bindings won't work, as swig probably expects the geany functions and global variables to be in a shared library. Also there would be problems with looking up plugin symbols from Geany, this would need to be coded specially. Still it's interesting anyway ;-)
I think
-I/usr/lib/python$(shell python -c "import sys;print sys.version[:3]")
will be better.
My dead project tw-light call python code. It uses swig to generate wrapper to make C/C++ variables and functions available in python code. I think It's source can be used to make python plugin as you described.
project link: http://developer.berlios.de/projects/tw-light/
Related files are here: http://svn.berlios.de/svnroot/repos/tw-light/trunk/source/python/ http://svn.berlios.de/svnroot/repos/tw-light/trunk/makefile