⚠️ DEPRECATION NOTICE
This package is deprecated as of Aspire 13.0. The functionality provided by this package is now part of the coreAspire.Hosting.Pythonpackage.Migration Guide:
- Replace
AddUvicornApp()calls withAspire.Hosting.Python.PythonAppResourceBuilderExtensions.AddUvicornApp()- Replace
AddUvApp()calls withAddPythonApp().WithUvEnvironment()- Update resource type references from
CommunityToolkit.Aspire.Hosting.Python.Extensions.UvicornAppResourcetoAspire.Hosting.ApplicationModel.UvicornAppResourceThis package will be removed in a future release. Please migrate your applications to use the core
Aspire.Hosting.Pythonpackage.
Provides extensions methods and resource definitions for the Aspire AppHost to extend the support for Python applications. Current support includes:
- Uvicorn
- Uv
- Streamlit
In your AppHost project, install the package using the following command:
dotnet add package CommunityToolkit.Aspire.Hosting.Python.Extensions
Please refer to the Python virtual environment section for more information.
Then, in the Program.cs file of AddUvicornApp, define a Uvicorn resource, then call Add:
var uvicorn = builder.AddUvicornApp("uvicornapp", "../uvicornapp-api", "main:app")
.WithHttpEndpoint(env: "UVICORN_PORT");Then, in the Program.cs file of AddUvApp, define a Uvicorn resource, then call Add:
var uvicorn = builder.AddUvApp("uvapp", "../uv-api", "uv-api")
.WithHttpEndpoint(env: "PORT");Then, in the Program.cs file of your AppHost project, define a Streamlit resource, then call Add:
var streamlit = builder.AddStreamlitApp("streamlitapp", "../streamlit-api", "app.py")
.WithHttpEndpoint(env: "PORT");https://learn.microsoft.com/dotnet/aspire/community-toolkit/hosting-python-extensions