How to create python bindings for a glib / gobject based library

I would like to create Python3 bindings for a glib / gobject based library namely infinote / libinfinity .

I am a bit puzzled about the required steps for this. Does PyGObject help here or not? Is this tutorial still valid for python3 and PyGObject?
If not, what do I need to read to understand how this will work?
Are there any tools to (semi) automate the process?

Thank you,
Fabian Henze


source to share

1 answer

You need GObject Introspection. Here is an overview page, and here are instructions on how to integrate it into your project if you are using Autotools (which is what I see you do.)

That's really all you need. Let's say you name your introspection repository Infinity-1.0.gir

. Then, after building and installing, all you need to do in Python is

from gi.repository import Infinity


And presto, your library can now be used with Python.

(PS. The manual you linked to is out of date.)



All Articles