1PYTHON setup.py build_ext --inplace
2PYTHON -c "import a"
3
4######## setup.py ########
5
6from Cython.Build import cythonize
7from distutils.core import setup
8
9# Add ./site-packages to sys.path
10from os.path import realpath
11import sys
12sys.path.append(realpath('site-packages'))
13
14setup(
15  ext_modules = cythonize("*.pyx"),
16)
17
18######## site-packages/b/__init__.py ########
19
20######## site-packages/b/other.pxd ########
21
22cdef extern from "foo.c":
23    int foo(int)
24
25######## site-packages/b/foo.c ########
26
27static int foo(int a)
28{
29    return a * a;
30}
31
32######## a.pyx ########
33
34from b.other cimport foo
35print foo(10)
36
37cimport b.other
38print b.other.foo(10)
39