[code-quality] pylint for cython?

Stefan Behnel stefan_ml at behnel.de
Fri Sep 12 21:47:33 CEST 2014


Skip Montanaro schrieb am 12.09.2014 um 20:38:
> On Fri, Sep 12, 2014 at 12:25 PM, Mike Müller wrote:
>> You should try pure Python mode:
>> http://docs.cython.org/src/tutorial/pure.html
> 
> So I leave my Python code as-is in somemodule.py and put the Cython
> declarations in somemodule.pyd. My make targets are map pyd files to so
> instead of pyx to so?

".py" -> ".so" instead of ".pyx" -> ".so", yes.

Latest Cython also has a "cythonize" script that can compile and build
modules ("cythonize -i pkg/module.py" -> "pkg/module.so").


> (I don't use setup.py. I'm very old school.)

That sounds a bit old-school, yes. To compile a Cython module, it can be as
simple as this:

"""
from distutils.core import setup
from Cython.Build import cythonize

setup(
    ext_modules=cythonize('hello.py'),
)
"""

And it will avoid rebuilding if it's up-to-date, just like make does.

(This is getting quite off-topic for this list, though...)

Stefan




More information about the code-quality mailing list