print "Hello World"

Save this code in a file named helloworld.pyx. Now we need to create the, which is like a python Makefile (for more information see Source Files and Compilation). Your should look like:

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

    ext_modules = cythonize("helloworld.pyx")

To use this to build your Cython file use the commandline options:

$ python build_ext --inplace

Which will leave a file in your local directory called in unix or helloworld.pyd in Windows. Now to use this file: start the python interpreter and simply import it as if it was a regular python module:

>>> import helloworld
Hello World


python -c 'import helloworld'

If you need to pass a parameter into the python you can do this by

python -c 'import helloworld' file1.txt 23 file2.txt