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.
Code: https://github.com/lazka/pgi
License: LGPL 2.1+
Requirements:
- CPython 2.7 or CPython 3.3+ or PyPy 1.9+ or PyPy3 2.3+
- libgirepository 1.0
- cffi 0.8+ (optional, but needed for tests)
- cairocffi 0.4+ (optional, for cairo support)
Usage¶
from pgi.repository import Gtk, GObject
or (preferred)
import pgi
pgi.install_as_gi()
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)).
Documentation¶
- PGI docs:
- Autogenerated GI docs:
Tests¶
- ./setup.py test will run unit tests using PGI and PyGObject
- ./setup.py test –pgi-only to skip PyGObject tests
- ./setup.py 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.
- ./setup.py quality will run pep8 and pyflakes tests
- ./setup.py coverage will create a test coverage report
Changelog¶
0.0.11.1 (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)
0.0.10.1 (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 (https://bugzilla.gnome.org/show_bug.cgi?id=727374)
- 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
0.0.6.3 (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)
0.0.6.2 (2013-11-16)¶
- Various fixes for new cffi/pygobject releases
0.0.6.1 (2013-04-24)¶
- Fix packaging
0.0.6 (2013-04-24)¶
- Basic cairo support (using cairocffi)
- Faster object creation
- Basic argument marshaling with signals
- New API documentation: http://lazka.github.io/pgi-docs/
0.0.5 (2013-03-20)¶
- Various fixes
0.0.4 (2013-02-04)¶
- Various fixes
0.0.3 (2013-02-02)¶
- Initial release