Fix for cimport from PEP420 namespace
See original GitHub issueWe have a project (https://github.com/cherab) that is split into a number of different sub-packages. Different teams/labs own the different sub-packages. We use namespaces to pull the separate packages together to appear as a single package. We have recently tried to make the package installable from pypi, however we have encountered an issue with cython compilation:
pip install cherab pip install cherab-openadas
The second package (dependent on the first) fails to compile, saying it can not find the pxd files. On investigating, pip appears to set up a PEP420 namespace where there is no __init__.py
in the root package. If I manually add an __init__.py
to the root of the package and try pip again, the cython compilation for cherab-openadas succeeds. Given this, I had a look through the cython source and noticed that during the pxd search, only paths with __init__.py/pxd
files are scanned. I removed the relevant check in Cython.Utils.search_include_directories() (on 0.29.x branch) and attempted the re-installation with pip in a clean environment. The compilation and installation was successful.
Given PEP420, is there any explicit need for the __init__.*
check? Could it be removed? On first look, I can’t see any reason it would cause a problem.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:15 (10 by maintainers)
Top GitHub Comments
Definitely
master
.I’ve encountered this issue as well, and because of our build system it is very difficult (not to mention unnecessary) to add
__init__.py
s everywhere. Perhaps @mkoeppe 's change can be done under a flag/directive?