Search for pxd files in sys.path. #91

merged 2 commits into from Feb 24, 2012


None yet

2 participants


As recently discussed on the mailing list, there seems to be a consensus that we should search for pxd files in python's sys.path.

I've implemented this basic feature in the simplest way possible --- by having Context.find_pxd_file search first in self.include_directories and then in sys.path.

This would close, as PYTHONPATH is automatically added to sys.path.

I've done some limited testing and haven't ran into any issues yet. files which use Cython.Distutils.build_ext and Cython.Build.cythonize both are able to compile pyx files which refer to globally installed pxd's.



Looks good, could you perhaps add a *.srctree test in tests/run? e.g. one that creates a directory, moves a pxd file in there and adds it to PYTHONPATH, which is then imported by a .pyx file?

[bfroehle@highorder cython (sys_path_pxd)]$ python cimport_from_sys_path
Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1]

Running tests against Cython 0.15.1+ b9aaa80540c420abbae65d2a51dbe85a92c87c67
Backends: c,cpp

Ran 1 test in 1.390s


Great, thanks a bunch!

@markflorisson markflorisson merged commit 725c588 into cython:master Feb 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment