How to deploy C # application that calls numpy through IronPython

I am writing a C # GUI application where I would like to use numpy which I used in Python 2.7 and which is very fast and easy to program. (I still find that working with a GUI in C # is much easier to use than PyQt.)

There is now an IronPython port of numpy and scipy, and I would like to know how to use it.

Before I start, I would like to know what deployment options will I have? Can I completely wrap python and numpy or do I need to install python, Ironpython, numpy on my client machines?

+3


source to share


1 answer


You can wrap Ironpython code in a .net assembly as DLL or exe. If you need to load code from other .NET code, create the DLL using the IronPython script

import clr
clr.CompileModules(dllname, module1.py, module2.py,...)

      

then load that assembly with



Assembly dpma = Assembly.LoadFile(Path.GetFullPath("CompiledIronPythonModule.dll"));
pyEngine.Runtime.LoadAssembly(dpma);

      

(C # example). In VisualStudio, you need IronPython and dll references in the project.

I just managed to compile numpy and scipy-refactored from scratch using IronPython 2.7.5, Visual Studio 2012.NET 4.0 with Intel Fortran Composer XE 2013 (using the latter, some changes are needed to scipy iron_setup.py files). The result is a collection of DLLs. I can import modules at this point on the IronPython command line. What still doesn't work is how to prepare IronPython code with numpy / scipy import into .net assembly. For this I will be checking ironpycompiler .

+1


source







All Articles