dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.94k stars 483 forks source link

Add first class support for running python apps with specified modules #6244

Open davidfowl opened 1 month ago

davidfowl commented 1 month ago

There's no first-class overload or different method to support running python apps where a module is the entrypoint and figuring out how to invoke the overloads that are there such that a module is used as the entrypoint is confusing due to the parameter counts and names. When combined with the previous point, this is what is required to run a Python app using a module as the entrypoint:

// You need to pass "-m" as the value for the 'scriptPath' parameter:
builder.AddPythonApp("python-app-module", "../PythonApp", scriptPath: "-m", ["module-name", "moduleArg1"]);
robotdad commented 1 month ago

We have someone looking to run one of our Python services using Aspire and this is the current blocker. They are going to investigate if they can create an extension to support uv integration which would also resolve it as that is our primary path right now outside of Aspire.

tommasodotNET commented 1 month ago

Hi, that someone would be me. I wrote a working uvicorn integration. Not sure whether to publish it here or in the CommunityToolkit.