Wrapper packages (was Re: [PyKDE] Heirarchy of header files !!)

Jonathan Gardner jgardner at jonathangardner.net
Fri Aug 15 17:13:00 BST 2003

Hash: SHA1

On Friday 15 August 2003 07:31, Charles Mason Iv wrote:
> I'm interested in starting a project of my own which involves a
> software package that for which I intend to provide wrapping calls to
> Python.  I've read numerous postings regarding who uses SWIG, Boost,
> or SIP, yet I havn't heard any concrete evidence why any of these are
> better than the other. 

There will probably never be concrete evidence one way or the other. 
This discussion will always be full of generalities and assumptions. 
It's like debating perl vs. python, or C vs. C++. One is not obviously 
better or worse than the other in all aspects.

> One person stated that you should only use
> SIP if you plan on interfacing with Qt.  Is this true?

If you are going to interface with Qt, sip is your only (good) option.

If you are interfacing with C++, sip is much better than SWIG.

If you are interfacing with C, it's a matter of taste. I wrote a wrapper 
for the PostgreSQL C API, and it was very easy and works very well. I 
haven't tried SWIG.

>  SWIG I read,
> is bloated and not-very-easy to use.

I think this is because SWIG is older and more mature. If you are 
interfacing with a simple C API, by all means, try SWIG. If you need 
reliability, documentation, and support, you may be better off with 
SWIG. Don't judge a project by its code size.

Phil Thompson has done a remarkable job supporting SIP as well, so don't 
discount that completely. The sip community is growing, and we are 
adding more and more documentation. The problem is that sip is still in 
development, though it is stable, and there are new features being 
added every release.

> In this day and age, shouldn't
> we be able to come up with a software package that's not only simple,
> but well designed too (with available documentation)? Which of the
> available wrapper generators out there do this?  Any ideas?  Which
> would be best to wrap an arbitrary library to python calls?

It all takes work to get these things. Phil Thompson has done most of 
the work by himself. If you like what you see, you should probably 
spend a bit of time documenting it and helping out with sip.

And again, the "best" way is going to depend on your exact needs and 
your exact tastes. Give them both a try. See which one works for you 
and which one doesn't.

- -- 
Jonathan Gardner <jgardner at jonathangardner.net>
Live Free, Use Linux!
Version: GnuPG v1.2.1 (GNU/Linux)


More information about the PyQt mailing list