Greg Ewing wrote:
> The idea of allowing __init__.pyx was so that the main
> code of a package could be written in Pyrex.
>
> However, I've never actually tested whether Python
> recognises an __init__.so file as a package main
> file, so I'm not sure if this works.
This is an issue for me, since I would like to be able to structure my
packages/modules something like the following (incomplete) tree:
Parsing.so
Crux/
__init__.so (Cythonized Crux)
Config.py
DistMatrix.so
Tree/
__init__.so (Cythonized Crux.Tree)
Parsimony.so
If it were possible to get Python to load __init__.so, everything would
be great, but Python reports:
ImportError: No module named Crux
I tried using the dotted file naming convention instead of the directory
hierarchy:
Parsing.pyx
Crux.pyx
Crux.Config.py
Crux.DistMatrix.pyx
Crux.Tree.pyx
Unfortunately, distutils turns that into:
Parsing.so
Crux.so
Crux/
Config.py
DistMatrix.so
Tree.so
This doesn't work because the Crux directory is not a package directory.
If I add a Crux/__init__.py, then Crux.so is ignored.
In fact, I haven't been able to find *any* way to get Crux to be a
Cythonized package. As a data point, Sage apparently uses a combination
of empty __init__.py files and all.py files, but never creates
Cythonized packages. Also, http://wiki.cython.org/PackageHierarchy
narrowly avoids what I'm trying to do. My searches for other examples
hasn't turned up anything more useful than this email thread.
Is there a way to nest Cythonized modules? To be clear, I would like to
be able to create all of the following as Cythonized loadable
packages/modules:
Crux
Crux.Tree
Crux.Tree.Parsimony
Thanks,
Jason
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev