[wingide-users] Using Wing IDE with IronPython - autocomplete for .NET objects (PI file generator)

Michael Foord fuzzyman at voidspace.org.uk
Tue Apr 28 11:05:46 MDT 2009

Wingware Support wrote:
> Michael Foord wrote:
>> I've created a modified version of the 'generate_pi.py' which 
>> generates the interface files for .NET libraries. It is attached.
> Looks good.  What we do for generating .pi files for CPython standard 
> builtin modules is use another script that imports generate_pi and 
> calls  generate_pi.ProcessModule.  This may be a good way to factor 
> out the .net specific bits.

Right - I was initially hoping to treat it more like a library than a 
script but didn't immediately spot that this was the point to do it.

I also had to make some minor changes inside ProcessModule (there is one 
class in System that calling dir on it raises an exception and I also 
needed support for dotted namespaces). This means I need to customize 
anyway. You can see the changes I've made.

I also need to automatically traverse into sub-namespaces. .NET 
namespaces are often nested, a single namespace can behave like a Python 
package. I need to investigate the PI format for this as I don't want to 
have to generate a separate file for each namespace.

>> It isn't yet able to do anything with the information about return 
>> types - which would allow Wing to know the type of objects returned 
>> by methods. This may be easy to add?
> This is done by generating a return statement in the def body, e.g. 
> from __builtin__.pi
> def open(name, mode = 'r', buffering = 1): # -> file object
>   """ .... """
>   return file(name, mode, buffering)

Cool - I was hoping it would be as simple as that.

> Thanks for looking at this.

Well, mostly self interest. ;-)

All the best,


> John


More information about the wingide-users mailing list