You can obtain automatically cython compiling using a "magic" sitecustomize.py in your base PYTHONPATH that calls pyximport, even if it requires some installation details (such as, under windows, your mingw location), here is an example :
import pyximport
import os
import numpy
#import cython
import Cython.Compiler.Options as Options
Options.cimport_from_pyx = True
if os.name == 'nt':
if os.environ.has_key('CPATH'):
os.environ['CPATH'] = os.environ['CPATH'] + numpy.get_include()
else:
os.environ['CPATH'] = numpy.get_include()
# XXX: we're assuming that MinGW is installed in C:\MinGW (default)
if os.environ.has_key('PATH'):
os.environ['PATH'] = os.environ['PATH'] + ';C:\MinGW\bin'
else:
os.environ['PATH'] = 'C:\MinGW\bin'
mingw_setup_args = { 'options': { 'build_ext': { 'compiler': 'mingw32' } } }
pyximport.install(setup_args=mingw_setup_args)
elif os.name == 'posix':
if os.environ.has_key('CFLAGS'):
os.environ['CFLAGS'] = os.environ['CFLAGS'] + ' -I' + numpy.get_include()
else:
os.environ['CFLAGS'] = ' -I' + numpy.get_include()
pyximport.install()
pyximport.DEBUG_IMPORT = True
As a side note, if you are under windows, please keep in mind that your cython must be slightly modified to use mingw.
You should also call your files *.pyx for this to work. Another advice : you should use the cython "pure python" syntax so that the Pydev editor will not complain.