Showing posts with label introspection. Show all posts
Showing posts with label introspection. Show all posts

Thursday, May 8, 2014

GNOME API reference at the DevX hackfest

Last week I spent a few days at the Developer Experience hackfest and got to have some fun again with the API reference generator in gobject-introspection.

Jon intended to hack on the XSLT stylesheets in yelp-tools/xsl, but after some trying he got discouraged by the amount of work that would take to get them to generate the HTML that we are interested in. We also discussed the benefits of using Mallard for generating the reference docs, and given that we want to generate a single output, we couldn't see much value in the level of indirection that Mallard adds.

Thus, we considered generating HTML directly from the GIR files, but shortly after Alberto Ruiz came by and offered to explore a client-side-only solution involving processing JSON files with JavaScript.

He very quickly got something relatively complete, which is very encouraging, but even more so is seeing how other projects are generating their API references that way, for example: http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.Class

Aspects such as as-you-type search would bring the online documentation on par with the Devhelp experience. Plus they have some niceties such as a symbol browser and links to annotated source code.

I have hacked a (yet another) --write-json-files switch to g-ir-doc-tool that will output the content of the GIR file to JSON, but indexed and formatted as needed by the JS side of things. See this branch for the code.

That branch also adds support for Markdown rendering using python-markdown, but some more code needs to be written to implement the extensions to Markdown that the Gtk+ docs are using.

It was great to talk about all this and more with old and new friends in Berlin, so I'm very grateful to the GNOME Foundation for organizing it and sponsoring travel, and to Endocode for providing a venue. And special thanks to Chris Kühl for the great organization!



Monday, February 20, 2012

Progress on generating Python API docs from introspection

The Docs hackfest in Brno is nearing to an end and I think enough progress has happened on generating API reference from introspection to warrant a report.

To see the current state, check the Telepathy-GLib reference generated here for Python.

Tomorrow morning will work on fixing some issues in the GIR files such as enum docs not making to it and then I will head home.

I'm not likely to work further on this, so if you think it can be of use to you, please consider lending a hand and contribute bugfixes and features. And if you don't like the design or the layout, just change it :)

Hope you have as much fun with this as I have had!

Once more, thanks to the GNOME Foundation, Red Hat and Collabora for sponsoring this work.

Below you can get a glance of what has been progressed on during these days, here is the changelog:
  • Add some more stuff to Enum pages
  • Display the hierarchy tree for classes
  • Install the Mako template files
  • Add AM_CHECK_PYMOD macro and use it to check for Mako
  • Remove stale DocBook files
  • Properly link to property pages
  • Fix names of xref links
  • Move constructor example to follow the class doc body
  • Properly link to signal pages
  • Fix the id of signal pages for Python
  • Qualify the class name in the constructor with the module name
  • Add links to properties in the constructor
  • Fix link
  • Show how to construct instances in the Class page
  • Add details for properties in Python
  • Add param information to signal pages in Python
  • Implement intra-namespace cross references
  • Use instances of MallardFormatter* instead of class methods
  • Remove some occurrences of empty Returns: lines
  • use True and False instead of %TRUE and %FALSE
  • Remove module and class from the function signature
  • Use template caching
  • Use None instead of %NULL
  • Use the ctype for the return type in signatures
  • Display Returns: even if there's no args
  • Update expected, some whitespace was removed
  • Add Since: tag to classes
  • Add Since: tag to mallard docs
  • Add function argument docs to the C template
  • Add argument docs to the Python template
  • Don't instantiate MallardFormatter for unknown languages
  • Update expected mallard for the doc tests

Friday, February 17, 2012

Docs hackfest: starting point

Have spent my trip to Brno undusting and rebasing the branch in gobject-introspection that uses to Mako templates to generate Mallard code from GIR files.

Here you can see how looks like the generated documentation for the Account class in the TelepathyGLib typelib for Python, and here is the one generated with gtk-doc.

As can be seen, there's still a long way to get even close to the gtk-doc level, but it's a very promising start.

Thursday, February 16, 2012

Documentation hackfest in Brno 2012

Tomorrow I'm taking the train to Brno to participate in the documentation hackfest, with plans to continue the work on generating API documentation from the GIR files that are generated by GObject Introspection.

I will be continuing the work that a bunch of us started in Berlin during the GObject Introspection hackfest last year.

Will be giving as well a workshop on GNOME application development with Python and GObject Introspection as part of the Developer Conference 2012 that Red Hat is organizing there.

Thanks to the GNOME Foundation for sponsoring my accommodation, to my employer Collabora for sponsoring my time there and Red Hat for sponsoring the venue and the food.

Monday, December 12, 2011

PyGObject 3.0.3 Released

The Sugar guys are doing great progress porting their code from PyGTK+ to GObject Introspection and they have requested a new stable release, which comes with these goodies:

- Convert all modifier constants to Gdk.ModifierType (Manuel Quiñones)

- Convert all strings to utf-8 encoding when retrieving from TreeModel (Sebastian Pölsterl)

- add test for bytearray variants (John (J5) Palmieri)

- handle NULL arrays correctly for each array type (John (J5) Palmieri)

- Revert "Revert "Fix array termination and size calculation"" (John (J5) Palmieri)

- pygmainloop: avoid lockups if multiple glib.MainLoop exist (Owen W. Taylor)

- Properly chain up to the class that implements a given vfunc. (Tomeu Vizoso)

- Revert "Fix array termination and size calculation" (Tomeu Vizoso)

- Fix array termination and size calculation (Holger Berndt)

- pygi-convert: fix for Pango.Alignment (Daniel Drake)

- pygi-convert: fix for Gtk.Orientation (Daniel Drake)

- Add tests for calling closures (Martin Pitt)

- fix marshaling of arrays of GVariants (Mikkel Kamstrup Erlandsen)

Thanks all for your hard work!

Wednesday, August 24, 2011

GObject Introspection hackfest in Berlin

A quick (and late!) recollection of what happened in Berlin during the GObject Introspection hackfest:
  • Red Hat's John (J5) Palmieri worked on new releases of PyGObject and on the documentation generators.
  • Prezi's Laszlo Pandy worked mainly in resurrecting Zach Goldberg's DocBook generator, merging it into master and adding important stuff to it such as description parsing and class hierarchy rendering.
  • Red Hat's Colin Walters reviewed code, gave input on people's direction and answered thousands of questions.
  • Syllogist's Shaun McCance added features to Mallard to match gtk-doc and worked on the DocBook and mallard generators.
  • Volunteer Torsten Schönfeld worked on improvements in gobject-introspection that are needed by his Perl bindings but that will benefit other bindings as well.
  • Canonical's Martin Pitt worked on server-side GDBus support in PyGObject and some improvements trickled to gobject-introspection.
  • Igalia's Guillaume Emont worked on adding default values to typelibs, #558620.
  • Codethink's Richard Dale worked on GObject-Consume, making it much easier to consume GObject-based APIs from Qt.
  • KDE volunteer Arno Rehn worked along with Richard on GObject-Consume.
  • Volunteer Johan Dahlin, as one of the maintainers, also supported all others, added missing information to the .gir files and hacked on the DocBook generator.
  • OLPC's Simon Schampijer worked on porting Sugar to use introspection instead of the static bindings.
  • Volunteer Pavel Holejsovsky couldn't be with us in Berlin but hacked along in #introspection adding stuff to gobject-introspection that his advanced Lua bindings were already needing.
  • Collabora's Tomeu Vizoso worked on the documentation generators and on the train back home rebased them to use Mako templates.
Nemein's Piotr Pokora and Nokia's Ivan Frade couldn't join us at the end because of unexpected obligations but we look forward to their contributions in the future.

Travel and lodging has been sponsored by the GNOME Foundation:


Openismus hosted us at their office when the Summit was over:


Nemein invited us to a delicious fondue dinner:


And Collabora treated us to tasty Ethiopian food and flooded us in beer afterwards:


Big thanks to those companies that sent their hackers, to the volunteers that devoted their time and talent, and to the sponsors for their support.

To close, I think this was a hackfest filled with fun and that we made good progress on the stated goals, most importantly having expanded the set of people that hack on gobject-introspection.

There were constant signs of appreciation towards Berlin, its food, beer, people and bike infrastructure. Looking forward for the next one!

Thursday, June 30, 2011

PyGObject BoF at the Desktop Summmit 2011

A BoF has just been proposed for the Desktop Summit in Berlin in August, this is the description:

We'll get together to port applications from PyGtk+ to Gtk+ 3 (using GObject introspection). Seasoned developers of PyGObject will meet applications developers and will help each other port applications and improve PyGObject itself.
The session is still just a proposal and we'll only know if it has been accepted in a few days, but if you will be at the Summit and this session interests you, please feel free to add yourself to the list of prospective participants.

See you in Berlin!

Tuesday, May 3, 2011

Time to port your Python application to GObject introspection?

From time to time I realize that not all maintainers of GNOME applications written in Python have been following what has been happening upstream during the GNOME 3 development cycle.

Some of the noise we have been making about introspection and hackfests may have reached them, but for someone who has only time to review patches and make releases, this new stuff may have seemed as of secondary relevance.

For those that are asking themselves whether they should invest time now into moving away from PyGtk and the other static bindings, I would summarize the decision as to whether you want your application to run on Gtk+ 3 (and other recent APIs in GNOME 3) or not.

Besides that, there are other advantages such as reduced memory usage, fast startup and being able to use libraries that have no static bindings.

About distribution, most major distros have already packaged the whole of GNOME 3 and the rest will follow in the following months. As a rule of thumb, if you can develop for GNOME 3 in C in a particular distro version, you have already all you need to port your app to introspection.

As always, I want to remember that PyGObject (and gobject-introspection for that matter) has no dedicated developers. If it's progressing forward is because some application authors decided to jump and lend a hand, so if you are producing code that uses GNOME and Python, please consider dedicating some time to file bugs, write test cases and maybe writing a patch yourself.

Monday, April 11, 2011

Session on GObject Introspection at the Ubuntu App Developer Week

The talk will be oriented to developers that use or want to use GNOME technologies and still haven't fully grasped how GObject Introspection is changing the game. It won't contain any distro specificities, so join without fear even if you don't use Ubuntu, if it's of your interest.

It should be of special interest to those willing to contribute to GNOME Shell or that plan to attend Martin Pitt's talk about life after PyGTK this Tuesday at 16 UTC.

You can find instructions about how to join in the link below, plus other interesting talks:

https://wiki.ubuntu.com/UbuntuAppDeveloperWeek

See you later today at 17 UTC.

Friday, April 8, 2011

GObject-Introspection hackfest

Following the success of the two last PyGObject hackfests, the idea of having one focused on GObject-introspection has been floating for a while.

After enough people agreed it could be a good idea, I have created a page in the wiki to start filling in the details. We should have a good provisional list of goals and participants before we get to things such as the place and date, which will be better decided once we have the participant list.

http://live.gnome.org/Hackfests/Introspection2011

So if you are planning to do some work on GObject-introspection that would benefit from happening in the hackfest, please add it to the goals list in the wiki.

If you won't be able to work on it yourself but you think something should really happen in the near future, please add it to the comments in this blog post.

I know we can count on consultancies such as my employer Collabora to sponsor the hackfest, but I would like to encourage downstreams to send their hackers and show they care, are able and deserve more good will.

Tuesday, February 1, 2011

Generating API docs from .gir files

From time to time people ask which are the plans about generating API documentation from the introspected information in the .gir files that g-ir-scanner outputs.

More often, I hear someone swearing about how hard is to setup gtk-doc to correctly generate documentation for your code. And getting g-ir-scanner to generate .gir files as expected is not completely trivial either.

It should be apparent that generating the docs from the .gir would save quite a bit of grief altogether but for one reason or another this hasn't happened yet. Docstrings are in the .gir files already along with the rest of the metadata but gtk-doc is still scanning the C sources.

© Juan José Sánchez Penas
During last GUADEC, the gobject-introspection people could be seen hacking in the lobby instead of attending your talk or rioting against the release team, and one of the outcomes was Zach Goldberg's g-ir-docgen script. His new employer forbids doesn't sponsor him for this work so this has been in the freezer since then.

So we can eventually get out from this situation, I would like to encourage interested non-coding people to add to CC on this bug: https://bugzilla.gnome.org/show_bug.cgi?id=625494

And to those that can actually code, please consider using that ticket to coordinate the effort, it may take less work than you think and it can be a fun hack. Think of all the GNOME hackers that will thank you!

Friday, December 3, 2010

Python ♥ GNOME Hackfest 2011

Looks like we are almost ready for one more push to Python development in GNOME 3, as originally announced by J5.

From 17th to 21th of January we'll be gathering at the brmlab hackerspace in Prague to hack on the applications of the brave souls that are taking the lead and port them to the future: Gtk+ 3, Python 3 and introspection.

We are having several GNOME volunteers, and Canonical, Collabora, OLPC, openSUSE and Red Hat  are sending their people to lend a hand.

If you think you should be there, please act quickly and add your name to the wiki before J5 secures the budget. If you would like to contribute to the funds or in any other way that would help this hackfest become a success, please send email to the GNOME Foundation board.

Tuesday, October 5, 2010

Notes on porting a Python application to GNOME 3

For you, GNOME Planet readers, Jordi is porting Naufrago! from PyGTK to GNOME 3 (so PyGObject + introspection) and has posted in his blog some notes that will help others doing the same.

Friday, October 1, 2010

Get the latest PyGObject and introspection bits!

So people are starting to port their apps to introspection from the about-to-be-obsolete PyGtk+ bindings and I'm getting questions in #python @ GIMPNet about how to get the latest and greatest version without having to build stuff.

For those in Fedora: you can get it already from F15, will be backported to F14 after it's out.

For those in Debian: watch experimental for updated packages soon.

For those in Ubuntu: update to Maverick and watch the telepathy PPA for updated packages soon.

Update from comments:

For those in openSUSE: you can get it already from openSUSE Factory, and will be backported to 11.3 as part of the GNOME 2.32 backport.

For those in Microsoft Windows: no binary packages have been built at this moment and nobody is currently known to be working on it.

If anybody has corrections or additions, please comment and I will update the main post.

Monday, September 20, 2010

Plans for the next cycle

So it's that time of the ½ year when one starts to think on what to spend his next months. Of course it will depend on what my employer thinks it's best, but this is what I'm thinking right now.

Port Sugar to telepathy-glib: right now Sugar uses Telepathy via python-dbus, which is a quite low level API. The code could get considerably shorter and simpler by using the higher level API in telepathy-glib. For that, we would need to use gobject-introspection because there are no plans for static bindings for Python.

Expose extended contact attributes through an official addition to telepathy-spec: Right now Sugar is using an extension to telepathy-salut and telepathy-gabble for discovering additional information about the online contacts. In our effort to make Sugar a regular Telepathy user and reducing the maintenance burden of such extensions, we should move to use only official additions to telepathy-spec.

Expose activities through an official addition to telepathy-spec: In Sugar you can discover which activities are being publicly shared by your contacts, join them and also send and receive private invites. This is basically announcing which applications running in your desktop have collaboration capabilities by means of IM channels. Same as above, we need to move to use interfaces of more general use.

Port Sugar to GNOME 3: Sugar's cycle is synchronized with GNOME, Fedora and Ubuntu so each release can be more easily packaged and delivered by distros. Though Gtk+2 and Gtk+3 are installable in parallel, the lamentable state in which the stable Python GNOME bindings are means nobody is there to maintain all the bindings and much less for wrapping new APIs such as GSettings. For the sake of moving along with our platform, we'll have to port Sugar and all the activities to GNOME 3 through with gobject-introspection. PyGObject is very close to have feature-complete support for introspection but still will take quite a bit of work to make it stable.

Thursday, July 8, 2010

Python and introspection are in Fedora

Colin Walters updated PyGObject in Rawhide to 2.21.4 and thus you can start using libraries with introspection support from Python without having to build anything yourself. One step closer to GNOME apps in Python 3.x!

If an interested Fedora packager is reading this, would be nice to split the _gi_cairo.so module to its own rpm so PyGObject itself drops again the dependency on PyCairo.

Monday, June 28, 2010

PyGI has been merged into PyGObject

Last week the people hacking on introspection support for PyGObject decided to merge (again) PyGI into PyGObject.

As soon as the patches in this bug get reviewed and pushed, I will be making a new release of PyGObject that will include introspection support.

For packagers, this means that PyGI packages can be dropped and that future releases of PyGObject will depend on introspection. The release notes will contain more specific information for packagers.

The 'pygi' component in bugzilla has been closed for new bugs and we are using component 'introspection' in the product 'pygobject'.

Similarly, the #pygi channel at GIMPNet has been changed to invite-only and we have registered the #python channel for all matters related to the internals of Python on GNOME. For user questions, please keep using #pygtk also on GIMPNet.

We need help updating the wiki to reduce the confusion caused by the brief but tribulated life of PyGI, at least we are certain that it has finally found its permanent home.

We hope that users of Python on GNOME will appreciate what introspection brings to our platform and also that from now on it will be more accessible to everybody.

Saturday, June 19, 2010

Proposed GNOME goal: Port your PyGTK to the new PyGI bindings

Javier Jardón has proposed this goal, which hopefully will make more prominent the convenience of starting to port your app from the old APIs as soon as possible.

If we fail to get a solid Python story in GNOME 3.0, it will be much more painful to do the porting in subsequent GNOME 3.x releases.

We still need many more people starting to port their apps and filing bugs (even better with patches!). And before you think it's too soon, read this bugzilla comment:

My app is a complex pygtk
program and with some, small change now is running with pygi,
i have errors in parts like "event.type == gtk.gdk.KEY_PRESS " or
actionGroup = gtk.ActionGroup("Actions")

but is running fast almost perfectly.

So we aren't perfect yet, but we're already useful and fast.

As an aside, I have heard through the grapevine that during GUADEC 2010 several people will meet to hack on introspection and PyGI. So if you want to have some of the PyGI hackers in the same room when you port your app, keep an eye on this and J5's blog for updates.

Thanks to Collabora for sponsoring my presence in GUADEC and to all the people who are working to make it possible.

Monday, June 7, 2010

PyGI now in Debian and Ubuntu

Thanks to the Debian GNOME Team, Laurent Bigonville and Canonical's Robert Ancell, PyGI is well on its way to Debian and Ubuntu:

http://packages.debian.org/sid/python-gi
https://launchpad.net/debian/+source/pygi/0.5.1-1

Thanks to everybody involved in this effort, upstream developers appreciate your work!

Friday, June 4, 2010

New PyGI release: 0.6.0

PyGI has seen a new release, follows the announcement:

Hi all,

this new release brings several new features and bug fixes and we feel application authors will have an easier time porting their software to use introspection. To mark this usability milestone we have started the 0.6.x series.

Apart from further feature and stability work, you can expect compatibility with Python 3.x in a future 0.6.x release.

http://ftp.gnome.org/pub/GNOME/sources/pygi/0.6/pygi-0.6.0.tar.gz

This release adds a dependency on gobject-introspection 0.6.14 or newer.

== Changes ==

* Added overrides for better compatibility with the old API:
GtkUIManager and GtkActionGroup
* Improved callback support
* Support for G*Array arguments
* Support for caller-allocates

== Join the effort! ==

Any feedback is welcome and the PyGI community will be happy to assist any porting efforts in the mailing lists mentioned below, in the #pygi IRC channel in Freenode and in GNOME's bugzilla:

Internals development mailing list:
http://mail.gnome.org/mailman/listinfo/python-hackers-list

Application development mailing list:
http://www.daa.com.au/mailman/listinfo/pygtk

Known issues: https://bugzilla.gnome.org/buglist.cgi?product=pygi&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&version=unspecified

Enter a new report: https://bugzilla.gnome.org/enter_bug.cgi?product=pygi

Main wiki page: http://live.gnome.org/PyGI

Regards,

Tomeu

--

John (J5) Palmieri (10)

* support for caller-allocates annotations for structs
* don't import gobject directly in the tests
* fix up Builder override, add new override methods, and add unit tests
* check refcounting of callback userdata in unit tests
* correctly handle floating objects in gtk
* Return an empty list when a NULL GList and GSList is returned
* fix NULL array unit tests and fix crasher when sending None as an array
* don't error out on methods with callbacks as return type
* reset sys.argv to the return value of Gtk.init_check
* add GtkUIManager and GtkActionGroup overrides

Steve Frécinaux (1)

* Fix warning in configure.

Tomeu Vizoso (12)

* Pre-release version bump 0.6.0
* Wrap C arrays in structs as GArrays before converting to Python
* Install pre-commit hook that checks the code changes for style conformance
* Apply consistent whitespace formatting with:
* Prepend gi.repository to the __module__ attribute of wrapper classes.
* Correctly identify at creation time:
* Dont complain if another base has implemented the method
* Improve handling of subclasses without __gtype_name__
* Add support for out args in callbacks
* Add support for GArray args
* GTypeInterface cannot be unrefed
* If None is passed to an interface which takes an object, convert it to NULL