As you may know there is already C# kernel for jupyter notebooks that was 
discussed previously here:

https://github.com/zabirauf/icsharp

But sometimes using Python and C# in separate kernels is not 
very convenient.

Last week I noticed a blog post on how to use C# magic cells with pythonnet 
from IPython kernel by Xavier Dupré @sdpython <https://github.com/sdpython> 
from 
Microsoft:

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:

*pip install clrmagic*

*%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); 
}

mypower(3.0,3.0)
27.0


Note that clrmagic works and is tested both on Windows (.NET) and Linux 
(Mono)! It should also work on OSX (Mono), but I have not tested.

Currently the source code is hosted here:

https://github.com/denfromufa/clrmagic


The clrmagic was modeled after fortran magic which uses f2py to extend 
Python with Fortran.


Regards,

Denis

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/31f2a31c-355c-4396-ba5e-74009758de6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to