To build I use distutils:
python setup.py build_ext --inplace
Building a simple pyx
-file works (setup.py):
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize('test.pyx')
)
Building more than one file (setup.py):
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
# This is the new part...
extensions = [
Extension('test', ['test.pyx', 'test2.pyx'])
]
setup(
ext_modules = cythonize(extensions)
)
test2.pyx:
def say_hello_to2(name):
print("Hello %s!" % name)
Building the above works fine and I see that both compilation and linking is completed successfully but it doesn't seem like the method say_hello_to2
is in the binary. Starting python, running the below shows that it's only the methods of test.pyx
is in the module:
>>> import test
>>> dir(test)
['InheritedClass', 'TestClass', '__builtins__', '__doc__', '__file__', '__name__
', '__package__', '__test__', 'fib', 'fib_no_type', 'primes', 'say_hello_to', 's
in']
>>>
Is it possible to add more than one pyx
-file to the extension build?