Skip to content

Instantly share code, notes, and snippets.

@rocarvaj
Last active July 28, 2016 21:15
Show Gist options
  • Save rocarvaj/ea6a2d5d3f7efbb01c1c6dee556ae5ec to your computer and use it in GitHub Desktop.
Save rocarvaj/ea6a2d5d3f7efbb01c1c6dee556ae5ec to your computer and use it in GitHub Desktop.
How to use Cython
  1. Create script my-script.pyx
  2. Create setup.py with
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [Extension("hello", ["hello.pyx"])]

setup(
  name = 'Hello world app',
  cmdclass = {'build_ext': build_ext},
  ext_modules = ext_modules
)
  1. Compile with python setup.py build_ext --inplace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment