[Numpy-discussion] rewriting NumPy code in C or C++ or similar
Mon Mar 7 23:54:08 CST 2011
On Mon, Mar 7, 2011 at 4:22 PM, Dan Halbert <firstname.lastname@example.org> wrote:
> On 3/7/2011 6:48 PM, Christopher Barker wrote:
>> On 3/7/11 3:36 PM, Dan Halbert wrote:
>>> We currently have some straightforward NumPy code that indirectly implements a C API defined by a third party. We built a Cython layer that directly provides the API in a .a library, and then calls Python. The layering looks like this:
>>> C main program -> API in Cython -> Python -> NumPy
>>> This is difficult to package for distribution, because of the Python and NumPy dependencies.
>> I'd say learn py2exe, py2app and friends, and be done with it.
>> Otherwise, I wonder if you could re-factor your Cython code enough to
>> remove all python dependencies -- or at least have something you could
>> compile and run without a python interpreter running.
> What we ship is the library and associated files. The library gets
> linked with someone else's main program. So py2exe and pyinstaller, etc.
> can't help much here, since we don't control the executable. I have
> thought about doing more in Cython, but I still need a libpython2.x.so,
> etc., I believe.
Can't you link libpython and all of the other dependancies into a
single .so file? This is the "embedding Python" idea--you can embed it
in another library, you don't have to be the top-level executable.
More information about the NumPy-Discussion