so library is also over 2,000 times larger than its source (54,000 compared to 20 bytes).
The C code is 2,648 lines, so it's quite a lot more text than the single line of hello.pyx source. Cython's cythonize module transforms hello.pyx into a hello.c file and a.
You can see the results in your project directory. A setup.py file is like Python's version of a makefile, and Cython can use it to process your Python code: from setuptools import setupįinally, use Cython to transform your Python script into C code: $ python setup.py build_ext -inplace pyx extension isn't magical and it could technically be anything, but it's Cython's default extension): print('hello world') It's not the best demonstration of Cython's advantages, but it shows what happens when you're using Cython.įirst, create this simple Python script in a file called hello.pyx (the. Transform Python into CĪ good way to start with Cython is with a simple 'hello world' application.