J5’s Blog

August 18, 2011

Calling all Introspection Hackers

Filed under: Gnome, community — J5 @ 6:47 pm

Want to become famous for a small amount of work? Want to have people thanking you for saving their project?  Well then step right up and write a tutorial about Introspection.  Ok, perhaps you won’t become famous and I might be the only person to thank you but here is a challenge for those who like to get their hands dirty in some of the more esoteric abilities of a piece of code.

As of now we have mostly been talking about introspection as a way to hook up existing GObject libraries to scripting languages but one of the most powerful features of Introspection is the ability to write your own C libraries inside your scripting project.  You may wish to do this for speed, or perhaps there is a feature that is not yet directly bindable via introspection.  While it is trivial to write one of these small libraries the devil is in the details and having a tutorial around would help people to dive in and play around.  What I am looking for:

  • Setup – show how to setup a makefile or even a setup.py file to compile a simple library, gir and typelib files.  Make sure the build env installs all the files to the correct locations and even has a way to test changes without installing
  • The C example 1 – show how to implement a simple function that takes simple input and returns output
  • The C example 2 – show how to implement different types of functions including multiple output functions and memory managed types
  • The C example 3 – show how to implement a gobject class with properties and other gobject features
  • The Vala examples – show how to do the above in Vala
  • Advanced topics could include callbacks

I’m pretty sure there may already be some Vala examples running around but the point of these tutorials would be to teach a scripter who is somewhat familiar with compiled languages how they could add lower level functionality to their project with out too much pain.  Are you up for the challenge?  Feel free to add a subpage to the PyGObject wiki.

[read this post in: ar de es fr it ja ko pt ru zh-CN ]

August 15, 2011

GObjects in Berlin: The search for more documentation

Filed under: GUADEC, Gnome, Python, community, conference — J5 @ 12:08 pm

One of the big topics of during the GObject Introspection Hackfest in Berlin has been generating documents directly from the .gir files.  While we are far from having complete documents for every supported language binding but thanks to Tomeu Vizoso,  Shaun McCance, Laszlo Pandy and Colin Walters with myself holding up rear after my work on the PyGObject 3.0 pre-release, we have a working framework.  Examples of the first output are available on my peoples page and you can get more information on the project page.

I would like to thank the Gnome Foundation for sponsoring travel and hotel as well as space during the Desktop Summit; Openisums for supplying us with space after the Summit was over; Nemein for the excellent Fondue dinner; Collabora for the Africana food that I had to miss due to the equally excellent cocktail party at Kat and Dave’s place; and KDE for the yummy Vietnamese lunch.

Much has been sewn and much has been grown, but now it is time to go.  Another successful hackfest is in the books and now the hard work of building on our achievements begins.  But first, some beer.

[read this post in: ar de es fr it ja ko pt ru zh-CN ]

August 14, 2011

[ANNOUNCE] PyGObject 2.90.1 released (3.0 pre-release)

Filed under: Gnome, Python — J5 @ 11:02 am

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:

http://download.gnome.org/sources/pygobject/2.90/

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.

Blurb:

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
johnp@redhat.com

[read this post in: ar de es fr it ja ko pt ru zh-CN ]

August 9, 2011

Ich bin ein Berliner

Filed under: GUADEC, Gnome, Python, community, conference, travel — J5 @ 11:53 am

And I am very tasty. Though I missed the main portion of the Desktop Summit I will be in Berlin early tomorrow (Wednesday) morning. I should be in time for the Introspection BOF provided I don’t get lost. I trust that taking the TXL bus to the Staatsoper stop will prove to be uneventful.

[read this post in: ar de es fr it ja ko pt ru zh-CN ]

August 3, 2011

I will be missing the Desktop Summit this year but I will be in Berlin

Filed under: Gnome, conference — J5 @ 1:15 pm

Due to my cousin’s wedding this weekend I will be missing the talks section of the Desktop Summit but will be in Berlin during the BOFs to attend the GObject Introspection hackfest.

[read this post in: ar de es fr it ja ko pt ru zh-CN ]

Powered by WordPress