Differences between revisions 10 and 11
Revision 10 as of 2008-05-06 20:05:41
Size: 2848
Editor: LauroMoura
Comment: Update tutorial link to new location.
Revision 11 as of 2008-11-15 14:00:34
Size: 2866
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
SIP is a tool for quickly writing Python modules that interface with C++ and C libraries. It's home page is at [http://riverbankcomputing.co.uk/sip/]. It was written by Phil Thompson who is still actively maintaining it. SIP is a tool for quickly writing Python modules that interface with C++ and C libraries. It's home page is at [[http://riverbankcomputing.co.uk/sip/]]. It was written by Phil Thompson who is still actively maintaining it.
Line 5: Line 5:
Full documentation can be found at [http://www.riverbankcomputing.com/Docs/sip4/sipref.html]. Full documentation can be found at [[http://www.riverbankcomputing.com/Docs/sip4/sipref.html]].
Line 7: Line 7:
SIP is used principally to support PyQt and ["PyKDE"]. Without it, it would be near impossible to manage the vast APIs these libraries provide. SIP is used principally to support PyQt and [[PyKDE]]. Without it, it would be near impossible to manage the vast APIs these libraries provide.
Line 11: Line 11:
For earlier versions of SIP, a simple wrapper written in C++ was usually necessary. A proof of concept can be found with Jonathan Gardner's ["sipPQ"], a python module that interfaces directly with libpq, which is the C library used to interface with PostgreSQL. You can find this at [http://sourceforge.net/project/showfiles.php?group_id=61057]. For earlier versions of SIP, a simple wrapper written in C++ was usually necessary. A proof of concept can be found with Jonathan Gardner's [[sipPQ]], a python module that interfaces directly with libpq, which is the C library used to interface with PostgreSQL. You can find this at [[http://sourceforge.net/project/showfiles.php?group_id=61057]].
Line 24: Line 24:
''Excerpt from [http://pegasus.rutgers.edu/~elflord/unix/siptute/ Programming With Sip]:'' ''Excerpt from [[http://pegasus.rutgers.edu/~elflord/unix/siptute/|Programming With Sip]]:''
Line 31: Line 31:
 * [http://www.controlvideo.de/sip/ Sip documentation]. This is by no means complete, but it is currently the best available  * [[http://www.controlvideo.de/sip/|Sip documentation]]. This is by no means complete, but it is currently the best available
Line 42: Line 42:
[http://vim.sourceforge.net/scripts/script.php?script_id=659] [[http://vim.sourceforge.net/scripts/script.php?script_id=659]]
Line 47: Line 47:
 * [http://www.controlvideo.de/sip/]
 * [http://www.riverbankcomputing.com/Docs/sip4/sipref.html Official Documentation]
 * [http://www.panix.com/~elflord/unix/siptute/index.html]
 * [[http://www.controlvideo.de/sip/]]
 * [[http://www.riverbankcomputing.com/Docs/sip4/sipref.html|Official Documentation]]
 * [[http://www.panix.com/~elflord/unix/siptute/index.html]]

SIP

SIP is a tool for quickly writing Python modules that interface with C++ and C libraries. It's home page is at http://riverbankcomputing.co.uk/sip/. It was written by Phil Thompson who is still actively maintaining it.

Full documentation can be found at http://www.riverbankcomputing.com/Docs/sip4/sipref.html.

SIP is used principally to support PyQt and PyKDE. Without it, it would be near impossible to manage the vast APIs these libraries provide.

Since v4.0 SIP can be used to interface Python with C libraries.

For earlier versions of SIP, a simple wrapper written in C++ was usually necessary. A proof of concept can be found with Jonathan Gardner's sipPQ, a python module that interfaces directly with libpq, which is the C library used to interface with PostgreSQL. You can find this at http://sourceforge.net/project/showfiles.php?group_id=61057.


More Details

SIP is really the combination of four components.

  1. A template language resembling C++ class declarations that describes how the Python module will interface with the C++ library.
  2. A tool to convert the script into C++ code and Python modules.
  3. A module to support the resulting Python modules and allow the programmer access to some of the SIP internals for special cases.
  4. A pure Python build system that supports dozens of platform/compiler combinations.


Excerpt from Programming With Sip:

Introduction

This is by no means an authoritative discussion about SIP. Rather, it is a chronicle of the adventures and misadventures of a bumbling newbie trying to learn to use a great tool with little documentation. Some references that are essential in conjunction to this include:

  • PyQt: an implementation of Python bindings for Qt. Reading the Sip files for these classes is instructive.

  • Sip documentation. This is by no means complete, but it is currently the best available

A Note About Versions

sip has changed from version to version. I'm using python 2.2 and sip 3.0pre7. Depending on the verion you're using, sip will behave a little differently. The most notable addition to the new version of sip is support for classes that are wrapped inside namespaces.


ViM Syntax Script

Jonathan Gardner has written an incomplete sip syntax script. You can use it when you are writing a sip script with the ViM editor.

http://vim.sourceforge.net/scripts/script.php?script_id=659

Tutorials & additional docs staff

Googling the web on SIP tutorials brought up

SIP (last edited 2012-02-21 17:38:01 by Alan Trick)

Unable to edit the page? See the FrontPage for instructions.