[ale] [OT] Calling Python from C ABI compatible languages

Brian Pitts brian at polibyte.com
Thu Sep 23 19:09:58 EDT 2010


On 09/23/2010 03:05 PM, Michael B. Trausch wrote:
> I know that this is technically off-topic for this list.  However, I'm
> faced with something of an interesting problem, and I'm wondering if
> anyone here has ever had something similar.  If anything, this is one of
> the reasons I _really_ dislike non-compiled programming languages.
> 
> I need to create a piece of software built around the GNU Bazaar
> revision control system, but it is written in Python.

When you say built around, what does that mean? Does most of the
functionality of the software you plan to write involve interacting with
Bazaar?

> Python is not an
> option for the system I am working on, and so there seems to me to be a
> bit of a problem.

When you say system, are you referring to the hardware your software
will run on or to the software you are writing? I'm guessing you meant
the latter since you talked about calling python code from C below,
which implies that your hardware can run a python interpreter.

If you mean the hardware, I'm curious why. The only thing I can think of
is a small device without enough memory to run a python interpreter. If
you mean the software, then it sounds like you either need to

1) Reimplement bazaar in C
2) Chose another DVCS to interact with. The first thing that came to
mind is git, since it's written in C, but I don't think git is
implemented as a library
3) Rethink python not being an option

[snip]

> I _guess_ I'm looking for some method to generate meaningful wrappers
> around Python libraries such that they can be used from another
> programming language.  Hell, if there were a Python front-end for GCC
> that could just compile Python code into normal binary code that I could
> call, I would be happy with that.
> 
> Is there any sort of system for this?  I don't want to spend six weeks
> creating one.

The closest project that I am aware of is http://code.google.com/p/shedskin/

-- 
All the best,
Brian Pitts


More information about the Ale mailing list