Christoph Groth
unread,Sep 27, 2012, 11:35:53 AM9/27/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cython...@googlegroups.com
Hi,
Relative imports work in Cython now, but relative cimports don't seem to
be working. Is my impression correct?
Specifically, we have right now:
from kwant.graph.defs cimport gint
from kwant.graph.defs import gint_dtype
I'd like to stop using the explicit name (=kwant) of the package
explicitly so that several versions of the package can be installed and
used simultaneously under different names. If cimport would be like
import, we could do
from .graph.defs cimport gint
from .graph.defs import gint_dtype
But this leads to the error message
****************************************************************
from .graph.defs cimport gint
^
------------------------------------------------------------
kwant/_system.pyx:8:0: 'graph.defs.pxd' not found
****************************************************************
The directory kwant/graph/ that contains defs.pxd and defs.h has been
added to the include path of Cython.
What actually does work is
from defs cimport gint
from .graph.defs import gint_dtype
But what if we have several defs.pxd in the various subpackages of our
package?
Is it possible to resolve this issue elegantly with current Cython?
thanks,
Christoph