[IPython-dev] Using multiple %%cython cell magics in the Notebook

Cyrille Rossant cyrille.rossant@gmail....
Wed Aug 28 17:31:02 CDT 2013


I'd like to use a function defined in a %%cython cell magic in another
%%cython cell magic. I could try to find the module's name of the
first cell magic (which is randomly generated) and import it in the
second, but that's not really convenient when dealing with many cells.

I tried %%cython_pyximport (which accepts a module name as argument)
but it does not work with "cimport numpy as np" (ImportError: Building
module mymodule0 failed: ["CompileError: command 'cl.exe' failed with
exit status 2\n"], I'm on Windows 8 64 bits, and this command does
work with %%cython). And the documentation suggests to use %%cython
anyway.

AFAIK %%cython does not accept an argument with the module name, which
could be used in subsequent modules for import. I think it would be
straightforward to add such option, I could do it if you think that's
a good idea.

What would you recommend?

Best,
Cyrille


More information about the IPython-dev mailing list