Wednesday, July 13, 2005

Pyrex Rocks!

In the project I am writing now I need to interface to F-Secure daemon, to scan files for viruses. They provide a very nice SDK to be used with C/C++, but ofcourse nothing for Python.

Here's where I come in :) When you hear words 'SDK', 'library' and 'Python' in the same sentance, the next thing you should immidiately think of - Pyrex
It's a nifty tool that provides you a very Pythonic way to write glue code to different libraries. You define what you want to import from the library, define the API of the exported functions, then create a wrapper class to access those, and it compiles it into a nifty Python extension! All you are left to do afterwards, is 'import my_ext' and use the class from it!
Since in the past I was messing with Perl and XS, I can truly appriciate the beauty of this approch!

Tomorrow I think I'll document the code, make a package and post it to PyPi. Stay Tuned.

No comments: