[Cython] Cython is not PEP-420 (Implicit Namespace Packages) compliant

Alexey V Gorshkov animus at wayround.org
Sat Dec 15 02:17:34 CET 2012


Hi!

Reporting about Cython PEP-420 (Implicit Namespace Packages) incompliance.

(Sample package setup attached)

(http://www.python.org/dev/peps/pep-0420/)

Next package's tree will not work and will return error

.
./setup.py
./firstlevel
./firstlevel/secondlevel
./firstlevel/secondlevel/mydearpackage
./firstlevel/secondlevel/mydearpackage/__init__.py
./firstlevel/secondlevel/mydearpackage/test.pyx
./firstlevel/secondlevel/mydearpackage/test_h.pxd


===== Error Message =====
 > python3 ./setup.py build_ext --inplace
running build_ext
cythoning firstlevel/secondlevel/mydearpackage/test.pyx to 
firstlevel/secondlevel/mydearpackage/test.c

Error compiling Cython file:
------------------------------------------------------------
...
cimport firstlevel.secondlevel.mydearpackage.test_h       ^
------------------------------------------------------------

firstlevel/secondlevel/mydearpackage/test.pyx:1:8: 
'firstlevel.secondlevel.mydearpackage.test_h.pxd' not found
building 'firstlevel.secondlevel.mydearpackage.test' extension
creating build
creating build/temp.linux-i686-3.3
creating build/temp.linux-i686-3.3/firstlevel
creating build/temp.linux-i686-3.3/firstlevel/secondlevel
creating build/temp.linux-i686-3.3/firstlevel/secondlevel/mydearpackage
i486-pc-linux-gnu-gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv 
-O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python3.3m -c 
firstlevel/secondlevel/mydearpackage/test.c -o 
build/temp.linux-i686-3.3/firstlevel/secondlevel/mydearpackage/test.o
firstlevel/secondlevel/mydearpackage/test.c:1:2: error: #error Do not 
use this file, it is the result of a failed Cython compilation.
error: command 'i486-pc-linux-gnu-gcc' failed with exit status 1
===== Error Message End =====

Simply adding __init__.py to firstlevel and firstlevel/secondlevel, and 
there will no building error

===== Normal Success Message =====
 >python3 ./setup.py build_ext --inplace
running build_ext
cythoning firstlevel/secondlevel/mydearpackage/test.pyx to 
firstlevel/secondlevel/mydearpackage/test.c
building 'firstlevel.secondlevel.mydearpackage.test' extension
i486-pc-linux-gnu-gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv 
-O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python3.3m -c 
firstlevel/secondlevel/mydearpackage/test.c -o 
build/temp.linux-i686-3.3/firstlevel/secondlevel/mydearpackage/test.o
i486-pc-linux-gnu-gcc -pthread -shared 
build/temp.linux-i686-3.3/firstlevel/secondlevel/mydearpackage/test.o 
-L/usr/lib -lpython3.3m -o 
/mnt/sda3/home/agu/p/pep420test/firstlevel/secondlevel/mydearpackage/test.cpython-33m.so
===== Normal Success Message End =====
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pep420test-0.0.0.tar.gz
Type: application/gzip
Size: 798 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20121215/ac73009a/attachment.bin>


More information about the cython-devel mailing list