Fabian Henze
Fabian Henze

Reputation: 1007

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 necessary steps to accomplish this. Does PyGObject help here or not? Is this guide 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?

Upvotes: 3

Views: 1299

Answers (1)

ptomato
ptomato

Reputation: 57910

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

That's really all you need. 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 is now usable from Python.

(PS. The guide you linked to is outdated.)

Upvotes: 3

Related Questions