c++boost.gif (8819 bytes) py_cpp*

The source code for py_cpp, including a MSVC demo project is available here.

Synopsis

py_cpp is a system for quickly and easily interfacing C++ code with Python such that the Python interface is very similar to the C++ interface. It is designed to be minimally intrusive on your C++ design. In most cases, you should not have to alter your C++ classes in any way in order to use them with py_cpp. The system should simply "reflect" your C++ classes and functions into Python.

Supported Platforms

py_cpp has been tested in the following configurations:

Py_cpp requires the boost libraries, and is has been accepted for inclusion into the boost libraries pending "boostification" (completion of the documentation, change in some naming conventions and resolution of some namespace issues).

Credits

Table of Contents

  1. A Brief Introduction to writing Python extension modules
  2. Comparisons between py_cpp and other systems for extending Python
  3. A Simple Example Using py_cpp
  4. Overridable Virtual Functions
  5. Function Overloading
  6. Inheritance
  7. Special Method Name Support
  8. A Peek Under the Hood
  9. Building a Module with Py_cpp
  10. Advanced Topics
    1. ClassWrapper<>
    2. enums
    3. References
    4. Pointers and Smart Pointers
    5. Built-in Python Types
    6. Other Extension Types
    7. Templates

More sophisticated examples are given in extclass_demo.cpp, extclass_demo.h, and test_extclass.py in the source code archive. There's much more here, and much more documentation to come...

Questions should be directed to the boost mailing list.

Naming Contest

Yes, I know py_cpp is a lousy name. Problem is, the best names my puny imagination can muster (IDLE and GRAIL) are taken, so I'm holding a naming contest. First prize? You get to pick the name<0.2wink> and you will be credited in the documentation. Names that have been suggested so far include:

Please post or send me your suggestions!

© Copyright David Abrahams 2000. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.

Updated: Oct 18, 2000