TL;DR
- Build your code like a module, and change file name .py to .pyx
- Add setup.py in your folder
- Add code in setup.py1234567from distutils.core import setupfrom Cython.Build import cythonizesetup(name = 'Your App Name',ext_modules = cythonize("your_code.pyx"),)
Remeber to change name
and ext_modules
- Run
python setup.py build_ext --inplace
to build code into .so file - Add a new file, which will import your lib and run the code1import your_code