Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a %%cython_annotate magic #2143

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

Add a %%cython_annotate magic #2143

dhirschfeld opened this issue Jul 16, 2012 · 3 comments
Milestone

Comments

@dhirschfeld
Copy link

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

@bfroehle
Copy link
Contributor

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.

@dhirschfeld
Copy link
Author

Apologies for not doing a proper issues search first!

@bfroehle
Copy link
Contributor

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 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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants