[SciPy-dev] Inclusion of cython code in scipy

Pearu Peterson pearu@cens.ioc...
Wed Apr 23 02:56:48 CDT 2008

Robert Kern wrote:
> On Tue, Apr 22, 2008 at 6:19 PM, Anne Archibald
> <peridot.faceted@gmail.com> wrote:
>> Hi,
>>  What do people think about including cython code in scipy?
>>  Pros:
>>  * Easy way to write faster code
>>  * Convenient way to interface to compiled code
>>  Cons:
>>  * Yet another interfacing setup
>>  * Yet another language readers of the code need to understand
>>  * Additional dependency for developers
>>  * cython is in flux and drastic improvements in its handling of numpy
>>  arrays are hoped for
>>  * Requires support in build tools (distutils/makefiles/scons magic)
> Well, we already have SWIG code in scipy and even Pyrex code in numpy.
> The way we have handled it thus far is to make developers check in the
> generated code. The setup scripts refer to the generated C files
> rather than the real sources. In most places, though, the lines to
> derive directly from the real sources are just commented out so
> developers can switch between them if they are touching that code.
> Checking in generated sources into source control is evil, frankly,
> but it resolves some of these headaches and replaces them with only
> lesser ones.
> I am all for your using Cython. Keep track of the version that you are
> using in a comment near the top of the file to warn other developers
> to use the same version or otherwise coordinate on upgrading.

In a longer term, we can add cython support to numpy.distutils (like
we currently have support for Pyrex, SWIG, f2py, template tools).
I wonder how big is the cython code base, may be it would be a worth
to make a snapshot of cython (when it becomes more stable) and
include it to numpy so that there would be no need to commit generated
sources to the repository. It might actually make scipy distribution
smaller as the generated sources may have higher LOC number than
the cython package.


More information about the Scipy-dev mailing list