One of the features that makes Python so powerful is the ability to take existing libraries, written in C or C++ and make them available as Python extension modules, SIP is a tool that makes it very easy to create Python bindings for C and C++ libraries.
SIP was originally developed to create PyQt, the Python bindings for the Qt toolkit, but can be used to create bindings for any C or C++ library. Many of its ideas are from SWIG but because it is specifically designed for C++ and Python, is able to generate tighter bindings.
SIP comprises a code generator and a Python module. The code generator processes a set of specification files and generates C or C++ code which is then compiled to create the bindings extension module. The SIP Python module provides support functions to the automatically generated code.
- Bindings are fast to load and minimise memory consumption when only a small sub-set of a large library is being used.
- Automatic conversion between standard Python and C/C++ data types.
- Overloading of functions and methods with different argument signatures
- Support for ordinary C++ functions, class methods, static class methods, virtual class methods and abstract class methods
- The ability to re-implement C++ virtual and abstract methods in Python
- Support for C++ exceptions and wrapping them as Python exceptions
- The ability to include documentation in the specification files which can be extracted and subsequently processed by external tools
- The ability to include copyright notices and licensing information in the specification files that is automatically included in all generated source code
- A build system, written in Python, that you can extend to configure, compile and install your own bindings without worrying about platform specific issues
- SIP and the bindings it produces, runs under UNIX, Linux, Windows and MacOS/X.
You can get the full SIP documentation here.
>> SIP – Overview
Latest posts by Content Team (see all)
- IndicThreads Pune 2016 To Equip Developers For A New Age Of Software Development - May 27, 2016
- Java Garbage Collectors – Moving to Garbage First (G1) Collector - May 25, 2016
- Using Lambdas and Streams in Java 8 - May 18, 2016