Thursday, June 6, 2013

Introduction

So, this introduction is a little belated, but better late than never, right?

About Me

My name is Tyler Wade.  I'm a computer science major at Washburn University in Topeka, Kansas.  I will be a senior when classes start again in August and, baring any extraordinary circumstances, will graduate next Spring.  As far as I know, I'm the first student from my university to be chosen for GSoC, which is kind of cool.

About the project

Right now there isn't much support among GUI toolkits for PyPy.  Using cpyext, TKinter and (classic) wxPython work, but because of the complexity involved in emulating CPython's extension API they are buggy and the performance isn't what it could be.  So to improve this situation, this summer I will be extending wxPython Phoenix to create a set of bindings that use CFFI.

wxPython Phoenix

wxPython Phoenix is a work-in-progress rewrite of wxPython that seeks to clean up the API and, more importantly to this project improve maintainability.  It achieves this latter goal by partially automating the creation of the bindings via a set of 'etg' scripts.   The first set of scripts, called 'extractors,' collect API data from the Doxygen XML files generated from wxWidgets' header files.  This data is then processed through a set 'tweaker' scripts to make the API more pythonic.  Finally, the API information is fed to a 'generator' script that creates the actual bindings.  Currently, the only genreator script in place creates sip files.

CFFI

CFFI is a library for exposing C code to Python.  Its similar to ctypes in terms of functionality, but is higher level and has a much nicer API.  PyPy has specific optimizations for CFFI and recommends it as the preferred way to call native code from Python.

What I will be doing

I will be creating a generator script that will create the CFFI bindings.  Unfortunately, it not as simple as that sounds: more than just Python code needs to be generated.  First of all, CFFI is not meant to wrap C++ code directly, so the generator will have to create a C-callable wrapper around the C++ API.  Second, some of the functionality that is provided by sip, for example deriving Python types from C++ types, will have to be replicated.  Lastly, the tweaker scripts contain a bunch of sip and CPython specific code that will have to be modified too.

You can follow my coding progress throughout the summer at https://bitbucket.org/waedt/wxpython_cffi, though there's nothing there just yet.


No comments:

Post a Comment