Skip to content
New issue

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

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

Already on GitHub? # to your account

[code_prettify] added support for IPython magics, cf #1018 #1019

Merged
merged 2 commits into from
Jul 14, 2017

Conversation

jfbercher
Copy link
Member

To support IPython magics in python code cells, a function yapf_reformat is defined and automatically loaded at initialization as a library. This function takes care of commenting magics before reformatting and uncommenting them after. This should fix #1018.

@catch22
Copy link

catch22 commented Jul 11, 2017

Thanks, this PR works well for me.

@EWouters
Copy link
Contributor

I noticed that 2to3 has no problem with cell magics without yapf_reformat for some reason unknown to me, but in autopep8 %%something will get returned as % % something.

Would it be a good idea to add this to the KernelExecOnCells library somehow? I guess we don't want kernel specific code in there, but handling cell magics is a problem any python extension will face when using the library.

I guess the best thing would be to write some js code that handles cell magics so it works for all kernels.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code_prettify does not recognize IPython magic commands
3 participants