I am pleased to announce version 2.90.1 of the Python bindings for GObject. This is an unstable release of what will eventually become PyGObject 3.0. PyGObject 3.0 is the first release that is completely based off of Introspection. To support legacy static bindings like PyGtk this release is parallel installable with PyGObject 2.28 provided introspection is turned off in the older module.
The new release is available from ftp.gnome.org:
What are the highlight of changes since PyGObject 2.28?
- New rewritten invoker is twice as fast and easier to extend and debug
- Complete break from static bindings so we may improve the core without breaking legacy APIs
- Better type handling
- Parallel installable with PyGObject 2.28 for legacy binding support (2.28 must be compiled with –disable-introspection)
- Fixed object array handling
- Added more overrides for PyGTK API emulation
- Support for function calling using keyword arguments
- GObject and GLib symbols can now have overrides
- All static bit removed or made private
- GVariants now work from callback returns
Do I need to port my apps from PyGObject 2.28 to PyGObject 3.0?
We tried to keep the API as close to what we were recommending for 2.28 however since 2.28 straddled both the static and dynamic APIs there are a few things to keep in mind when running under 3.0:
- don’t import pygtk – this was for static bindings only and while it may have been harmless in 2.28 it will cause conflicts in 3.0
- import gobject must be ported as from gi.repository import GObject – this was the recommended way of importing GObject but some code may still have used import gobject. Having both will cause applications to fail because it will load the older 2.28 bindings alongside the 3.0 bindings.
- import glib must now be ported as from gi.repository import GLib – this is a new requirement and prevents the issues discussed above
- use the gi.require_version API (e.g. gi.require_version(’Gtk’, ‘3.0′)) – This is more of a recommendation as we will be outputting warnings in the future. Due to the rapid development of certain libraries like the upcoming Gtk-4.0, it is best to specify the major version of the library you wish to target instead of relying on PyGObject to select the latest one available on the system. This also gives helpful errors if the correct version is not installed on the user’s system.
GObject is a object system used by GTK+, GStreamer and other libraries.
PyGObject provides a convenient wrapper for use in Python programs when accessing GObject libraries.
Like the GObject library itself PyGObject is licensed under the GNU LGPL, so is suitable for use in both free software and proprietary applications. It is already in use in many applications ranging from small single purpose scripts up to large full featured applications.
PyGObject now dynamically accesses any GObject libraries that uses GObject Introspection. It replaces the need for separate modules such as PyGTK, GIO and python-gnome to build a full GNOME 3.0 application. Once new functionality is added to gobject library it is instantly available as a Python API without the need for intermediate Python glue.
Introspection/Python 2 bindings requires gobject-introspection >= 0.9.5 and py2cairo >=1.10.0
Introspection/Python 3 bindings requires gobject-introspection >= 0.9.5, pycairo >=1.10.0 and Python >= 3.1
John (J5) Palmieri
GNOME Foundation member