.NET/C# Interop to Python
<p>My backend is written in .NET/C#, I have a requirement that I need to execute python scripts passing context from the .net side of the house. These are queued up in a background task engine called <a href="http://hangfire.io/" rel="nofollow noreferrer">hangfire</a> running as a windows service.</p>
<p>I did a little digging and found <a href="http://ironpython.net/" rel="nofollow noreferrer">IronPython</a>, however, after implementing it failed to support many of the pypi python packages that I need to execute inside my script.</p>
<p>Secondly, I looked at <a href="https://github.com/pythonnet/pythonnet" rel="nofollow noreferrer">Python.Net</a> which is a embedded interpreter that embeds or extends CPython. CPython can run all the scripts/etc that I needed, however, I found that opening/closing the python interpreter all the time can create quite a few memory leaks and there is always threading constraints there too. See <a href="https://docs.python.org/2/c-api/init.html#bugs-and-caveats" rel="nofollow noreferrer">docs</a> for some of the details.</p>
<p>I'm wondering if this interopt and embedding python in .net is even a good idea. I'm wondering if making python its own execution engine using something like <a href="http://www.celeryproject.org/" rel="nofollow noreferrer">celery</a> and marshalling data between the two using something like <a href="https://developers.google.com/protocol-buffers/" rel="nofollow noreferrer">protobufs</a> would be a better solution? This adds much more complexity and an additional task engine to my stack too.</p>
<p>I was wondering if anyone else had any ideas/feedback/experiences trying to accomplishing something similar? Thanks!</p>