PGI - Pure Python GObject Introspection Bindings

GObject Introspection bindings written in pure Python using ctypes and cffi (optional). API compatible with PyGObject.

Development Status:

WARNING: Lots of things are not implemented/supported.

See the ‘examples’ directory for working examples. Anything else will probably not work.


License: LGPL 2.1+



from pgi.repository import Gtk, GObject

or (preferred)

import pgi
from gi.repository import Gtk, GObject

Search paths

Typelibs will be loaded from paths in the environment variable GI_TYPELIB_PATH and /usr/lib/girepository-1.0/.

Shared libraries from paths in LD_LIBRARY_PATH and the default system search paths (see dlopen(3)).

  • ./ test will run unit tests using PGI and PyGObject
  • ./ test –pgi-only to skip PyGObject tests
  • ./ test –filter=StructTest to run tests which include StructTest (regexp)

./tests/libs/ includes additional libraries that will be used for testing if present. Call make in ./tests/libs/ to build them.

  • ./ quality will run pep8 and pyflakes tests
  • ./ coverage will create a test coverage report

Changelog (2016-02-07)

  • Fix sdist (Sunil Mohan Adapa) [pr 30]

0.0.11 (2016-01-31)

  • Various fixes..
  • Oldest supported Ubuntu is now 14.04 (was 12.04) (2015-04-07)

  • fix tests

0.0.10 (2015-03-23)

  • Fix lib filenames using OS X (Benjamin Henne) [pr 16]
  • Reduce PyGObject overrides diff
  • tools: new tdump tool to print the typelib content as json
  • docs: GArray return, GList out args, Unichar fields, GError fields, GStrv
  • docs: include signal owner type in signal signature

0.0.9 (2014-08-08)

  • Memory leak fixes (Petter Waller)
  • Work around for broken Poppler.Page.get_text_layout (Petter Waller)
  • Some small fixes/improvements

0.0.8 (2014-07-03)

  • Support for PyPy3
  • Improved error messages (in generated code)
  • Use namedtuple-like for multiple return values (
  • Remove Gst overrides to match PyGObject
  • Some minor compatibility fixes, performance improvements

0.0.7 (2014-03-24)

  • Python 3 support
  • Clutter overrides removed to match PyGObject
  • Implement GObject.list_properties
  • Multiple docstring fixes for pgi-docgen
  • Expose callback types as dummy functions with docstrings
  • Sync GLib overrides with PyGObject trunk (2013-11-29)

  • Marshalling fixes: GList[int], gunichar, foreign structs, cairo.Surface,
  • Match pygobject signatures for functions taking a callback
  • Docstring improvements (needed for pgi-docgen) (2013-11-16)

  • Various fixes for new cffi/pygobject releases (2013-04-24)

  • Fix packaging

0.0.6 (2013-04-24)

0.0.5 (2013-03-20)

  • Various fixes

0.0.4 (2013-02-04)

  • Various fixes

0.0.3 (2013-02-02)

  • Initial release