Python bindings for the Geany plugin API.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Write Geany plugins in Python!

Please note: since GeanyPy is under heavy development, the API it exposes may change quite drastically. If you start using GeanyPy to write plugins, drop me a line and I'll do my best to not break your code.

Update: There's now some documentation available, visit to read it.

How it works

In the src/ directory is a normal Geany plugin (plugin.c) which loads the Python interpreter. It then loads some C Python modules (dialogs.c, documents.c, etc.) that interface with Geany's C API. After that, it loads the geany Python module which is just glue/sugar-coating to make the C module more "Pythonic".

To write a plugin, inherit from the geany.Plugin class and implmenent the required members (see geany/ documentation comments). Then put the plugin in a searched plugin path. Currently two locations are search for plugins. The first is PREFIX/lib/geany and the recommended location is under your personal Geany directory (usually ~/.config/geany/plugins). To load or unload plugins, use Geany's regular Plugin Manager. Python plugins appear there once GeanyPy is activated.

When the Python Console plugin is enabled, it will add a new tab to the notebook in the message window area that contains an interactive Python shell with the geany module pre-imported. You can tinker around with API with this console, for example:

import geany # called automatically in the built-in interactive shell

doc ="/some/file/here")


geany.dialogs.show_msgbox("Hello World")

geany.main_widgets.window.set_title("Hello Window")

def on_document_open(doc):
    print("Document '%s' was opened" % doc.file_name)

geany.signals.connect('document-open', on_document_open)


To build GeanyPy you need the following dependencies:

  • Python 2.6+ and development files (I don't think Python 3 will work).
  • Geany 0.21+ and development files (from SVN)
  • PyGTK 2.0 and development files

On Debian/Ubuntu, the (non-Geany) dependencies can be installed like this:

$ apt-get install python python-dev python-gtk2 python-gtk2-dev

See Geany's documentation/website for information on compiling it from the Subversion or Git repositories.


First you need to know where Geany is installed:

$ GEANY_PREFIX=`pkg-config --variable=prefix geany`

The you can install as normal:

$ ./
$ ./configure --prefix=$GEANY_PREFIX
$ make
# make install

You should be able to force a specific version of Python to be used, by using the PYTHON_VERSION environment variable, but I've only tested with 2.6.6 so far. I imagine 2.7 series will also work fine.

Running on Windows

See README.win32 for more information.