using expy to extend python

Discussion in 'Python' started by Yingjie Lan, Aug 6, 2009.

  1. Yingjie Lan

    Yingjie Lan Guest

    Hi,

    The expy project provides an express way to extend Python. After some careful considerations, I came up with some reasons for expy (this is not an exhaustive list):

    (I). WYSIWYG. The expy project enables you to write your module in Python the way your extension would be (WYSIWYG), and meanwhile write your implementation in pure C. You specify your modules, functions, methods, classes, and even their documentations the usual way of writing your Python correspondences. Then your provide your implementation to the functions/methods by returning a multi-line string. By such an arrangement, everything falls in its right place, and your extension code becomes easy to read and maintain. Also, the generated code is very human-friendly.

    (II). You only provide minimal information to indicate your intension of how your module/class would function in Python. So your extension is largely independent from the Python extension API. As your interaction with the Python extension API is reduced to minimal (you only care about the functionality and logic), it is then possible that your module written in expy can be independent of changes in the extension API.

    (III). The building and setup of your project can be automatically done with the distutil tool. In the tutorial, there are ample examples on how easily this is achieved.

    (IV). Very light weight. The expy tool is surprisingly light weight dispite of its powerful ability, as it is written in pure Python. There is no parser or compiler for code generation, but rather the powerful reflexion mechanism of Python is exploited in a clever way to generate human-friendly codes. Currently, generating code in C is supported, however, the implementation is well modularized and code generation in other languages such as Java and C++ should be easy.

    While there are already a couple of other projects trying to simply this task with different strategies, such as Cython, Pyrex and modulator, this project is unique and charming in its own way. All you need is the WYSIWYG Python file for your module extension, then expy takes care of everything else. What follows in this documentation is on how to extend Python in C using expy-cxpy: the module expy helps define your module, while module cxpy helps generate C codes for your defined module.

    For more information about expy, please visit its homepage at: http://expy.sf.net/

    Cheers,

    Yingjie
    Yingjie Lan, Aug 6, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yingjie Lan

    releasing expy 0.1.1

    Yingjie Lan, Aug 12, 2009, in forum: Python
    Replies:
    0
    Views:
    275
    Yingjie Lan
    Aug 12, 2009
  2. Yingjie Lan

    expy 0.1.2 released!

    Yingjie Lan, Sep 5, 2009, in forum: Python
    Replies:
    0
    Views:
    267
    Yingjie Lan
    Sep 5, 2009
  3. Yingjie Lan

    expy 0.1.3 released!

    Yingjie Lan, Sep 8, 2009, in forum: Python
    Replies:
    0
    Views:
    312
    Yingjie Lan
    Sep 8, 2009
  4. Yingjie Lan

    expy 0.2 released!

    Yingjie Lan, Sep 22, 2009, in forum: Python
    Replies:
    0
    Views:
    202
    Yingjie Lan
    Sep 22, 2009
  5. Yingjie Lan

    announcement: expy release 0.5

    Yingjie Lan, Jan 26, 2010, in forum: Python
    Replies:
    0
    Views:
    250
    Yingjie Lan
    Jan 26, 2010
Loading...

Share This Page