On 01/12/11 09:18, Alexandre Fayolle wrote:
On Wednesday 30 November 2011 20:05:38 Simon Schampijer wrote:
Hi,

I tired to run pylint* over code that is using gobject-introspection like:

from gi.repository import Gtk
button = Gtk.Button()

Pylint does not seem to recognize this:

E:  1: No name 'Gtk' in module 'gi.repository'

I googled and grep'ed a bit around and it does not seem to have been
came up so far. Is this not supported at present?  Are there any plans
to do so?

Hello Simon,

The short answer is "no it is not supported".

Pylint is not very good with dynamic code since it tries very hard not to
import the modules it checks, which means it does not see the results of code
executed at import time. Same thing for classical Python introspection
constructs (getattr/setattr, __dict__ manipulation, etc.)

Recent development make it easier to help pylint grasp these. See
http://www.logilab.org/blogentry/78354 for instance. We at Logilab don't use
gobject, so there is little chance we will get the itch leading us to write
such a plugin for gobject. On the other hand, we will be very happy to
integrate or point to any plugin provided and maintained by other (hint,
hint), and of course we will provide support in the writing of such a plugin.


Hi Alexandre,

thanks for your thoughts!

I have been looking a bit around what would make sense for static analysis of code that uses python gobject-introspection. G-I provides the module information through a gir file and a typelib [1]. Extracting the metadata from the typelibs (faster than through gir files) sounds like the right approach, that information we would then need to add at runtime using the machenism you described above with a pylint plugin.

Regards,
   Simon

[1] http://live.gnome.org/GObjectIntrospection/Architecture
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to