ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Py++

(1/1)

tinjaw:
As I learn more and more python, I am starting to branch out into other areas. Today I am researching how to utilize the gargantuan amounts of C++ code that is already out in the wild. I may have stumbled upon a silver bullet with the combination of Py++ and Boost.Python.

The process becomes one of putting the C++ source code through Py++ to generate the code necessary to utilize Boost.Python. The end result is C++ code that is easily utilized by pythonistas in a pythonic manner.

What is Py++?

Definition:

    Py++ is an object-oriented framework for creating a code generator for Boost.Python library.

Py++ uses few different programming paradigms to help you to expose C++ declarations to Python. This code generator will not stand on your way. It will guide you through the whole process. It will raise warnings in the case you are doing something wrong with a link to the explanation. And the most important it will save your time - you will not have to update code generator script every time source code is changed.
Code generation process

Boost.Python library allows you to expose C++ code to Python in quick and elegant way. Code generation process, using Py++ consists from few steps. Next paragraphs will tell you more about every step.
--- End quote ---

Features list

    * Py++ support almost all features found in Boost.Python library
    * Py++ generates code, which will help you to understand compiler generated error messages
    * Py++ has few modes of writing code into files:
          o single file
          o multiple files
          o multiple files, where single class code is split to few files
    * Py++ will save your compilation time - it will rewrite a file, only in case of change
    * You have full control over generated code. Your code could be inserted almost anywhere.
    * Your license is written at the top of every file
    * Py++ will check the "completeness" of the bindings. It will check for you that the exposed declarations don't have references to unexposed ones.
    * Py++ provides enough functionality to extract source code documentation and write it as Python documentation string
    * Py++ provides simple and powerful framework to create a wrapper for functions, which could not be exposed as is to Python.
    * ...

--- End quote ---

mouser:
this made my head hurt.  sounds interesting though.

scriptedfun:
How does this compare to SWIG? I'm really interested in finding ways to make C++ libraries work in Python :)

tinjaw:
How does this compare to SWIG? I'm really interested in finding ways to make C++ libraries work in Python :)
-scriptedfun (January 18, 2007, 12:42 AM)
--- End quote ---

There is some comparison info on the Py++ site.

Don't forget that version 2.5 has ctypes as part of the standard library, so in some cases it is easy enough to just sling some raw python code at the problem.

scriptedfun:
Thanks, tinjaw. I actually started using Python as a stepping stone to learning OOP in C++, but made it my primary language in the process :). Hopefully with tools like these, I will be able to take advantage of what C++ has to offer without actually using C++ :).

Navigation

[0] Message Index

Go to full version