topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 6:12 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Py++  (Read 5198 times)

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Donate to Member
Py++
« on: January 13, 2007, 09:18 AM »
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.

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.
    * ...

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Py++
« Reply #1 on: January 13, 2007, 05:11 PM »
this made my head hurt.  sounds interesting though.

scriptedfun

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 21
    • View Profile
    • scriptedfun.com
    • Donate to Member
Re: Py++
« Reply #2 on: January 18, 2007, 12:42 AM »
How does this compare to SWIG? I'm really interested in finding ways to make C++ libraries work in Python :)
Chuck Arellano - Game Programming Video Tutorials for Beginners at scriptedfun.com

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Donate to Member
Re: Py++
« Reply #3 on: January 18, 2007, 10:46 AM »
How does this compare to SWIG? I'm really interested in finding ways to make C++ libraries work in Python :)

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

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 21
    • View Profile
    • scriptedfun.com
    • Donate to Member
Re: Py++
« Reply #4 on: January 30, 2007, 09:01 PM »
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++ :).
Chuck Arellano - Game Programming Video Tutorials for Beginners at scriptedfun.com