Reputation: 26333
First, if i have a project that is all python (no C++ or C) files, what is the advantage of using Cython, vs, say, using the python library directly (for integration in a large C++ software program) ?
Second, to compile the .pyx files to Cython, i intend to use setup.py
file with this code:
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize(MyString)
)
What should MyString
be ? the name of the python (.pyx) files without extension ? should it include a full path ? where should be located the setup.py
file so that it cythonizes the files ? If not this way, how to properly Cythonize the files ?
What is the proper way to use Cython when dealing with a library containing only .py files ?
How to use the setup.py
to cythonize (see more detailled questions above) ?
Upvotes: 2
Views: 1253
Reputation: 10667
Hum there is a lot of question here.
what is the advantage of using Cython, vs, say, using the python library directly ?
If you only use Python library (eg: for network stuff), using Cython should not be of great help. Cython will greatly help you if:
What should MyString be ?
They are a lot of option here. I usually use
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("myext", ["myext.pyx", "myextlib.pyx"])])
You'll find a lot of information at Cython compilation documentation For a small library, you can put it in the same directory as the source.
Upvotes: 1