Add a %%cython_annotate magic #2143

Closed
dhirschfeld opened this Issue Jul 16, 2012 · 3 comments

Comments

Projects
None yet
3 participants
Contributor

dhirschfeld commented Jul 16, 2012

I've hacked up a little function to display the output of cython -a

def cython_annotate(path):
    import os
    os.system("cython.py -a {path}".format(path=path))
    with open(os.path.splitext(path)[0] + ".html") as istream:
        html = istream.read()
    return html
#

At present this can be called as shown below if you know the filename of the .pyx file:
from IPython.display import HTML
HTML(cython_annotate(path_to_pyx_file))

It would be great if this functionality could be added as part of the cython extension.

Cheers,
Dave

Contributor

bfroehle commented Jul 16, 2012

Hi Dave, We think this is a fantastic idea as well. Our original plan was to just have this be an optional flag on the existing magic, i.e. %%cython -a. See #1976.

I'm going to close this issue as a duplicate, but link back here since you have some good sample code.

bfroehle closed this Jul 16, 2012

Contributor

dhirschfeld commented Jul 16, 2012

Apologies for not doing a proper issues search first!

Contributor

bfroehle commented Jul 16, 2012

No worries! If you want to try your hand at submitting a pull request we'll be happy to review it. Otherwise it'll take a few weeks but we should get to the other issue.

minrk added this to the no action milestone Mar 26, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment