announcement - IPython cell magic for C# usage in jupyter notebooks (clrmagic)
Last week I noticed very useful blog post on how to use C# magic cells with pythonnet from IPython by Xavier Dupré @sdpython <https://github.com/sdpython>: http://www.xavierdupre.fr/blog/2014-09-20_nojs.html As a result of this, we put together a package clrmagic <https://pypi.python.org/pypi/clrmagic> that can be installed and loaded into jupyter notebooks in 3 steps: *pip install clrmagic* *jupyter notebook* In open notebook enter: *%reload_ext clrmagic* Here is a small demo: %%CS mypower System.dll public static double mypower(double x, double y) { if (y == 0) return 1.0 ; return System.Math.Pow(x,y) ; } <function clrmagic.create_cs_function.<locals>.<lambda>> mypower(3.0,3.0) 27.0 Note that clrmagic works and is tested both on Windows and Linux! It should also work on OSX, but I have not tested. Currently the source code is hosted here: https://github.com/denfromufa/clrmagic I plan to host this code in pythonnet repository under: https://github.com/pythonnet/clrmagic Let's wait for one week to get any feedback from this mailing list and jupyter group (to be posted later this week). Thanks, Denis and Xavier
participants (1)
-
Denis Akhiyarov