Hi!
On 21 Jul., 21:08, Willem Jan Palenstijn <[email protected]> wrote:
...
> I think a clean way to do this would be to package the Cython wrapper
> for the optional SPKG inside that SPKG. Then it would get compiled
> only when the SPKG is installed. Inside sage you could then detect at
> run-time if the wrapper module is importable, and if so, use it.
Yes, I think this is the natural way to do. If you have it in your
SPKG and use distutils, it would be installed into SAGE_ROOT/local/lib/
python2.6/site-packages/, and then you can simply import it into your
Sage session or any other sage module.
I mean, how else could it be? Have a Cython wrapper sitting in the
Sage tree for code that is *not* in the Sage tree, and is potentially
not installed?? I can't see how this should work.
> There doesn't seem to be any sage-specific infrastructure currently for
> putting Cython code in an .spkg (Unless I missed it, which is quite
> possible). Maybe we could generalize the code in
> sage/setup.py a little bit to make it importable in an spkg's setup.py
> script?
Yes. I recently created my first SPKG, which contains a lot of Cython
code, and at first it seemed impossible to cimport cdef'd types from
the Sage tree (I don't know if you want to do those things). William
then demonstrated *using the notebook* what paths I need to include in
my setup.py in order to cimport things -- the best notebook
application I've ever seen!
So, I think it would be good to provide some infrastructure to make
writing Cython code in SPKGs more easily fit with the rest of Sage.
Cheers,
Simon
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---