[Geany-devel] Python Plugins, re-hashed

Matthew Brush matthewbrush at xxxxx
Sat Dec 4 02:12:19 UTC 2010


Hi,

I started working on Python plugin support for Geany. Some of the code 
and the general approach is based on what Māris Fogels had started at 
https://code.launchpad.net/~mars/+junk/geany-python-bindings.

I've put my code up at https://github.com/codebrainz/geanypy.The README 
file explains the concept pretty well I think and the code should be 
easy to follow.

The majour problem with this code right now is the Python ctypes 
bindings that I managed to mush out of a couple of auto-generator 
scripts (h2xml & xml2py which come with ctypeslib). To put it bluntly my 
bindings are crap.

Maris had a completely different bindings generator which might be (MUST 
be) better, but I couldn't figure out how to generate the bindings. 
Maris (or anyone else in the know), if you're on the mailing list, it 
would be awesome if you could give me a little help with generating your 
bindings.

Ultimately, the ideal approach would be to do the bindings in Cython, 
which in my opinion is a far superior way of doing it since it's faster 
and more natural for a Python programmer to use than ctypes. I'm not 
positive, but I think it
would require having a shared library for the plugin API in order to 
link with the C code generated by Cython, I haven't gotten this far yet.

As it stands now, the code works, loads the plugins, passes pointers to 
the 3 structures of GeanyPlugin, GeanyData, and GeanyFunctions, which 
can be accessed through some hackery to dereference the pointers in Python.

I wanted to get the opinion of some real programmers about this code and 
maybe some ideas about how to get the required data into a usable 
Pythonic API. Any input or feedback anyone can provide would be very 
much appreciated.

Cheers,
Matthew Brush (codebrainz)



More information about the Devel mailing list