Python Based API

Larry Bates larry.bates at websafe.com
Mon Apr 2 13:19:21 EDT 2007


Dean.Brotzel at gmail.com wrote:
> Hi,
> 
> I work on a project that is built entirely using python and Tkinter.
> We are at the point where we would like to give access to our
> functionality to others via some sort of API.  People who would use
> our API develop in all kinds of languages from C/C++ to Pascal.
> 
> Ideas that come to mind that allow us to build such an API are:
> 
> 1)	Require others to imbed the python interpreter via the c API to be
> able to utilize our functionality.
> 2)	Build an XML RPC interface around our code.
> 3)	Rewrite our code base in C/C++, which should make it accessible to
> all modern languages.
> 
> I'm looking for more and potentially better ideas that will allow us
> to offer an API to our customers without having to throw away or redo
> a lot of the python code that we have already written.
> 
> Thanks in advance,
> Dean
> 

You don't say what your operating system is, so I'll give an answer in
case it is Windows:

I went through something similar recently and decided that writing a COM
wrapper around my Python API was the best answer (and it turned out to
be pretty easy).  I was easily able to call from VB, Delphi and Python
COM.  I haven't tried C/C++ yet, but expect no problems.  I think COM is
now the way to go (unless you do .NET).

-Larry




More information about the Python-list mailing list