Experiments in removing/replacing PyCXX

Drat, re-sending on the list.

···

On 1 December 2012 16:40, Thomas Kluyver <thomas@…1120…> wrote:

On 1 December 2012 14:44, Michiel de Hoon <mjldehoon@…42…> wrote:

At the same time, to minimize errors, we could use Cython to create the initial Python/C glue code, and then add the generated code to the matplotlib codebase. Then neither users nor
developers have to install Cython, we don’t have to worry about inconsistencies (if any) between different Cython versions, we don’t have to worry about keeping the Cython source code and the generated code in sync, and we will still get a high-quality Cython-generated Python/C glue code.

Having looked at some bits of Cython-generated C code, I wouldn’t recommend that. I’m sure it’s high quality in terms of compiling and running correctly, but it’s definitely not designed to be read or maintained directly. Here’s a sample from SciPy to illustrate:

https://github.com/scipy/scipy/blob/master/scipy/stats/vonmises_cython.c#L2269

For another reason, there have been cases where the Cython-generated C code was broken in some way, and it was fixed by regenerating with a newer version of Cython. I experienced this with pyzmq when testing with Python 3.3 for example - it completely failed to import until I installed a newer version of Cython and redid the conversion. If you don’t keep the original Cython code, you don’t have this option.

Best wishes,
Thomas