I feel as though this question is a duplicate, but I haven't found one on the subject (specifically) yet so I'll ask anyway:
What Python/C++ binding libraries would you recommend and why? In addition, what has been your experience using it or any others you have tried? Also, what binding features do they contain and has your use of them been personal or professional?
To kick things off, here are some that I've tried recently (for personal use):
SWIG
- Supports Python 2 and 3
- Can be uber-automatic under the right circumstances
- When it's not uber-automatic it mostly consists of repeating your .h files and providing hints
- Supports many other languages besides Python (Java, Ruby, Lua, etc.)
- Output consists of both a native file (to be compiled into a .pyd) and a python "wrapper"
- Bindings appear to be reasonably lean.
- Does not appear to support properties (values accessed by getter/setters)
- Very well documented, easy to follow setup instructions
- Used by Google (hey, that's got to count for SOMETHING, right?)
Boost::Python
- Only supports Python 2. Python 3 support is in progress, but no release date yet. (as of Sept 09)
- Syntax can be awkward to newcomers, but is straightforward and mostly clutter free.
- Heavy use of C++ templates (can be a good or bad thing)
- Distributed as part of the Boost library, which is huge. (Useful, but huge)
- Compiling the library initially can be an exercise in frustration
- Can significantly increase compile times
- Some quirky gotchas, like specifying return value policies for functions that return native types
- Very solid, stable, well-tested library
- Does support properties
- Documentation is so-so. Decent introductory tutorials but more advanced usage is somewhat neglected. Documentation is also fragmented: There are at least three different tutorials on how to build the library, all of which differ greatly.
- Bindings have a reputation for being somewhat bloated
I'm currently using Boost::Python, mostly because I really need property support, but I'm very curious to see what people's opinions are of some of the other libraries out there!