Hi guys, i was talking with some pypy guys about work in this summer in GSoC with C++ bindings to Pypy and i wrote a proposal and i like that you review it. Igor PROPOSAL: Problem Pypy are becoming one of the most used Python interpreter because it is easy and flexible, but we still have a big problem, it does not have any binding to any Graphical User Interface(GUI) and we have the second problem, many GUIs are wrote in C++(like Qt or WxWidgets) and Pypy can not access C++ code because it does not have any C API, it just can access C code using ctypes. Solution Many solutions had been argued but the main solution is use Reflex[2],which is developed at CERN (which has an incredible amount of C++ libraries). It is not mainly intended for writing Python bindings for C++ libraries but instead provides reflection capabilities for C++. The idea is that for every C++ shared library, an additional shared library is produced, which allows together with Reflex to introspect properties of C++ classes, methods, etc. at runtime. These facilities are then used for writing a small generic CPython extension module, that allows CPython to use any C++ library for which this reflection information was generated [3]. This approach is a bit similar to the ctypes module, apart from the fact that ctypes does not use any reflection information, but the user has to specify the data structures that occur in the C code herself. This makes it sometimes rather burdensome to write cross-platform library bindings. For PyPy the approach seems rather fitting: We would need to implement only the generic extension module(a C language interface to Reflex) and could then use any number of C++ libraries. Goals The main goal of this project is to do a C reflex interface and make an easy API using ctypes to RPython communicate with that interface. More specific, the goals of the project are: 1.create an interface to reflex in C; 2.Use RPython ctypes to communicate with it; 3.create an API to RPython ctypes have an easy way to communicate with C reflex. 4.Begin a binding to Qt; Timeline The Google Summer of Code is subdivided in two parts. First part plans: 1.work in reflex to create a C interface for it. 2.Begin work on RPython ctypes; Second part plans: 1.create an API to RPython ctypes communicate with C reflex; 2.Begin Qt binding; Bio My name is Igor Trindade Oliveira, I am a Undergraduate Computer Engineering student in Brazil, in the fourth year. I work also in KDE project in KDE-PIM projects[1] and have experience with microcontrollers like 8051, MSP430, Mips r4000 and Arm 9. And with KDE I have very experience with C++ code. [1] http://techbase.kde.org/Projects/PIM/Akonadi/Testing [2] http://root.cern.ch/drupal/content/reflex [3] http://morepypy.blogspot.com/2008/10/sprint-discussions-c-library- bindings.html
Igor Trindade Oliveira wrote:
Hi guys,
i was talking with some pypy guys about work in this summer in GSoC with C++ bindings to Pypy and i wrote a proposal and i like that you review it.
Igor
PROPOSAL:
Problem
Pypy are becoming one of the most used Python interpreter because it is easy and flexible, but we still have a big problem, it does not have any binding to any Graphical User Interface(GUI) and we have the second problem, many GUIs are wrote in C++(like Qt or WxWidgets) and Pypy can not access C++ code because it does not have any C API, it just can access C code using ctypes.
Solution
Many solutions had been argued but the main solution is use Reflex[2],which is developed at CERN (which has an incredible amount of C++ libraries). It is not mainly intended for writing Python bindings for C++ libraries but instead provides reflection capabilities for C++. The idea is that for every C++ shared library, an additional shared library is produced, which allows together with Reflex to introspect properties of C++ classes, methods, etc. at runtime. These facilities are then used for writing a small generic CPython extension module, that allows CPython to use any C++ library for which this reflection information was generated [3]. This approach is a bit similar to the ctypes module, apart from the fact that ctypes does not use any reflection information, but the user has to specify the data structures that occur in the C code herself. This makes it sometimes rather burdensome to write cross-platform library bindings. For PyPy the approach seems rather fitting: We would need to implement only the generic extension module(a C language interface to Reflex) and could then use any number of C++ libraries.
... I wonder if py++ would help?
On Mar 24, 2009, at 2:18 PM, Neal Becker wrote:
Igor Trindade Oliveira wrote:
Hi guys,
i was talking with some pypy guys about work in this summer in GSoC with C++ bindings to Pypy and i wrote a proposal and i like that you review it.
Igor
PROPOSAL:
Problem
Pypy are becoming one of the most used Python interpreter because it is easy and flexible, but we still have a big problem, it does not have any binding to any Graphical User Interface(GUI) and we have the second problem, many GUIs are wrote in C++(like Qt or WxWidgets) and Pypy can not access C++ code because it does not have any C API, it just can access C code using ctypes.
Solution
Many solutions had been argued but the main solution is use Reflex[2],which is developed at CERN (which has an incredible amount of C++ libraries). It is not mainly intended for writing Python bindings for C++ libraries but instead provides reflection capabilities for C++. The idea is that for every C++ shared library, an additional shared library is produced, which allows together with Reflex to introspect properties of C++ classes, methods, etc. at runtime. These facilities are then used for writing a small generic CPython extension module, that allows CPython to use any C++ library for which this reflection information was generated [3]. This approach is a bit similar to the ctypes module, apart from the fact that ctypes does not use any reflection information, but the user has to specify the data structures that occur in the C code herself. This makes it sometimes rather burdensome to write cross-platform library bindings. For PyPy the approach seems rather fitting: We would need to implement only the generic extension module(a C language interface to Reflex) and could then use any number of C++ libraries.
... I wonder if py++ would help?
When people were looking at what would be best to use they considered py++ (and boost.python). One of the reasons to not use it is that if I remember correctly py++ uses gcc-xml and it needs the source of the C++ library before generating some cpython module that needs to be compiled also. One of the good points of Reflex is that after the generation of the reflection library you don't need the source of the package neither a compiler installed, and reflex supports c++ also (which would be interesting if we want to convince OS people of including reflex modules of c++ libraries). Could Reflex be made to generate a reflex module of c packages also, so you don't have to declare them again in ctypes in python and all languages that support libffi? That would be cool. -- Leonardo Santagada santagada at gmail.com
On Tuesday 24 March 2009 14:13:25 Leonardo Santagada wrote:
On Mar 24, 2009, at 2:18 PM, Neal Becker wrote:
Igor Trindade Oliveira wrote:
Hi guys,
i was talking with some pypy guys about work in this summer in GSoC with C++ bindings to Pypy and i wrote a proposal and i like that you review it.
Igor
PROPOSAL:
Problem
Pypy are becoming one of the most used Python interpreter because it is easy and flexible, but we still have a big problem, it does not have any binding to any Graphical User Interface(GUI) and we have the second problem, many GUIs are wrote in C++(like Qt or WxWidgets) and Pypy can not access C++ code because it does not have any C API, it just can access C code using ctypes.
Solution
Many solutions had been argued but the main solution is use Reflex[2],which is developed at CERN (which has an incredible amount of C++ libraries). It is not mainly intended for writing Python bindings for C++ libraries but instead provides reflection capabilities for C++. The idea is that for every C++ shared library, an additional shared library is produced, which allows together with Reflex to introspect properties of C++ classes, methods, etc. at runtime. These facilities are then used for writing a small generic CPython extension module, that allows CPython to use any C++ library for which this reflection information was generated [3]. This approach is a bit similar to the ctypes module, apart from the fact that ctypes does not use any reflection information, but the user has to specify the data structures that occur in the C code herself. This makes it sometimes rather burdensome to write cross-platform library bindings. For PyPy the approach seems rather fitting: We would need to implement only the generic extension module(a C language interface to Reflex) and could then use any number of C++ libraries.
... I wonder if py++ would help?
When people were looking at what would be best to use they considered py++ (and boost.python).
One of the reasons to not use it is that if I remember correctly py++ uses gcc-xml and it needs the source of the C++ library before generating some cpython module that needs to be compiled also. One of the good points of Reflex is that after the generation of the reflection library you don't need the source of the package neither a compiler installed, and reflex supports c++ also (which would be interesting if we want to convince OS people of including reflex modules of c++ libraries).
Could Reflex be made to generate a reflex module of c packages also, so you don't have to declare them again in ctypes in python and all languages that support libffi? That would be cool.
right now i dont know but i can check it, but i believe that it just works with C++ packages. Igor Trindade Oliveira
-- Leonardo Santagada santagada at gmail.com
_______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
participants (3)
-
Igor Trindade Oliveira
-
Leonardo Santagada
-
Neal Becker