Yes, it is possible, but generally one would need a good reason for doing so.
It basically comes down to figuring out how the languages are going to talk to each other. In the world of web development, one can have HTTP calls go from one server to another (One can be C# and another can be Python).
You could also look into something like IronPython to bring Python into the .NET environment.
In general, though, all you need to do is to figure out some way for the different languages to talk to each other, be it through implementation of Python for the .NET platform, HTTP calls, file transfers, communicating through message brokers or good ol' system commands.
My personal recommendation would be to stick with one, as having two languages can complicate things early on.
Sorry if this the wrong sub.
Question: Is it at all possible to convert a (FastAPI) backend written in Python to C# (for .NET) automatically?
Backstory:
I'm interning in this non-IT division. They told me to build a backend using Python. Did that for the last 3 months. And on my last 2 week I'm told that their IT division can't handle Python and told me to somehow convert the project to C# (which I have 0 exp in). I'm aware of https://pythoncsharp.com/
but skeptical of it, because FastAPI is a Python framework and I can't imagine it running using C#.
I'm also aware to possibility to cross-compile(?) my python to CLR (https://ironpython.net/
and https://github.com/pythonnet/pythonnet
). But IT people said it is highly unpreferable as they will want to maintain/update the code, and will not be able to do so if the backend is still written in Python.
IronPython has actually been around for ages, it's python for .net/clr much like jython is for the jvm.
Official releases are still at 2.7 level, but they're working on 3, much like Jython guys.
You can run the python interpreter in C#, and parse the script's output, or any other IPC mechanism you choose (memory mapped file, sockets, whatever)
Or you can use something like IronPython to host python in C# and do it, or just nost the interpreter yourself.
Depending on how you want to handle things, you could use something like https://ironpython.net/, but Newt is correct in that you'll probably want some sort of restful backend in Python.
Well, you can write a frontend that calls the backend through HTTP (or whatever). So you'll have a Python server.
Alternatively, you have IronPython.
Though, I'm unsure why you would want to though.
It seems like your two options here are PyAutoCad and IronPython.
I'm not too familiar with either, as I am just starting up the process of potentially working with python in CAD. The most trouble I am having is starting the initial link and set up between the two.
Hopefully this helps! Let me know if you are able to get anywhere.
IronPython would like to have a word:
Plus PyPy which is written in a subset of python.
https://en.m.wikipedia.org/wiki/PyPy
Python is an interpretated language and any other language can be used to create that interpretor. PyPy uses RPython which is a subset of python that is compiled. It was bootstrapped using C, but no longer uses C (as far as I know).
This is like saying C was built using assembly so that's really the future. It's a naive understanding of how the tools used for building software work. For most people they will never look at C when doing machine learning. There is a much smaller group of people creating libraries and optimizing the code for python developers.
The being said, I think cpython is great for machine learning and data science but it's not great for more general development. The great part about cloud is that you can create specific services using the best tools and languages while connecting then using web api or other interop mechanisms.
Tldr;. Software is more complex than just the language and saying a certain flavor of python uses an interpreter written in C is like saying I have to use a rock to make a hammer. I can also use a hammer once it's made and never use the rock made hammer out care about rock made hammers.
He could make a Windows-enhanced version of Python, that includes tight integration with Windows, and call it IronPython. Then they could lose interest in it and palm it off to a group who don't have the means to adequately continue it, and so keep it stuck on the Python 2.7 train that has already run off the tracks. They could even set up the domain for it many years ago: https://ironpython.net/. That would be like HP deciding that their printers will all work on Windows 11 after they already said they won't support Windows 10.
The .net DLL COULD be generated as COM or dllexport, which would allow you to load it with python-native ctypes (note if it's COM it'll need to be registered properly), but I don't know how likely that is if the library doesn't explicitly say it is.
If it's .net only and you can easily switch to a different python interpreter, you can try IronPython or Python for .net. I can't personally vouch for them though.
Otherwise, I do think you'd have to write some C# to make a com or dllexport wrapper for the library.
The first thing you'll need to do is pick a programming language to write your plugin in. I would suggest Python, as it's geneally seen as an easy beginner's language.
You'll also need to learn how to use the .NET framework, per Playnite's pages, plugins need to be written using that.
The Playnite pages explicitly reference https://ironpython.net/ which looks like a combination of Python (v2) and .NET, so that seems like a good place to start. I prefer Python 3 myself, but I couldn't find an easy Python 3/.NET setup with just a few minutes of googling.
Search for IronPython tutorials (or tutorials for whatever language you choose) and start with those. Don't worry about starting on your plugin for now, just learn how to write some basic "Hello World" style code and get that working. Then, once you've got a preliminary feeling of how you might go about starting your plugin, you can dip your toes into that.
Hoepfully, by then, the Playnite tutorials will also make more sense.
I mean, if you're feeling super retro and crazy you can always install the not-actively-developed IronPython, which is built on the soon-to-be-deprecated Python 2, install the .NET Office primary interop assemblies, and create, use, and free COM objects - a very old and generally avoided API - all in order to do Office automation.
If you're crazy, that is.
I tried IronPython (https://ironpython.net/documentation/dotnet/) years ago and was surprised how easy to use it was. Checked it out briefly now, looks like .NET Standard package is now available, although only in alpha release.