[Cython] missing cimport in module '.' - bug?

Stefan Behnel stefan_ml at behnel.de
Fri May 13 05:05:25 EDT 2016


Christoph Groth schrieb am 03.05.2016 um 16:19:
> The setup.py script of our package "kwant" uses Cython.Build.cythonize.
> Everything works well, except that for pyx files that cimport a module
> from "." an error message is generated.  E.g. for the file
> "kwant/linalg/lapack.pyx" that contains the line
> 
> from . cimport f_lapack
> 
> The following message appears whenever setup.py is run:
> 
> missing cimport in module '.': kwant/linalg/lapack.pyx
> 
> No error message appears for files that cimport only from somewhere else
> than ".", e.g.:
> 
> from .defs cimport gint
> 
> The said messages do not seem to cause any problems, but they are of
> course somewhat of a nuiscance.  They seem to be created by
> Cython.Build.Dependencies.cimported_files().  The culprit seems to be
> the function find_pxd in that module that does not seem to handle
> properly the case when module is ".".

Yes, that's a known problem. It only impacts the dependency collector that
decides if a rebuild is necessary, and which is intentionally kept simple.
It does not have an effect on the compiler itself.

Looks like no-one has worked on this so far, but the correct code is
available in other places (obviously) where the imports are resolved.
Patches welcome.

Stefan



More information about the cython-devel mailing list