Add include to cython magic without copy-paste?

32 views
Skip to first unread message

Ian Bell

unread,
Apr 28, 2018, 7:09:54 PM4/28/18
to cython...@googlegroups.com
The Cython magic in Jupyter notebook is a super nice way to experiment with Cython code outside of a full project, and I love it.  What I don't love is that I have to copy-paste paths from numpy.get_include() into the cell magic call.  Obviously this breaks if, for instance, I wanted to integrate cython magics into a notebook that is run on another computer, an automatic documentation build server, etc.

Is there a workaround for this that I am not aware of?  Setting a magic environment variable at runtime, etc.?



Thanks,
Ian

Stefan Behnel

unread,
May 28, 2018, 3:46:47 PM5/28/18
to cython...@googlegroups.com
NumPy seems important enough to break the rules in the Cython magic
implementation. We could either always add it to the include paths if it
can be imported (although importing it might be quite costly if it's not
used), or we could at least define (and detect) an alias name for the NumPy
includes which users could then write into their distutils directive, and
which would trigger a NumPy import and setting the alias in the cythonize()
call.

Stefan
Reply all
Reply to author
Forward
0 new messages