Aspire.Hosting.Python
13.6.0
Prefix Reserved
dotnet add package Aspire.Hosting.Python --version 13.6.0
NuGet\Install-Package Aspire.Hosting.Python -Version 13.6.0
<PackageReference Include="Aspire.Hosting.Python" Version="13.6.0" />
<PackageVersion Include="Aspire.Hosting.Python" Version="13.6.0" />
<PackageReference Include="Aspire.Hosting.Python" />
paket add Aspire.Hosting.Python --version 13.6.0
#r "nuget: Aspire.Hosting.Python, 13.6.0"
#:package Aspire.Hosting.Python@13.6.0
#addin nuget:?package=Aspire.Hosting.Python&version=13.6.0
#tool nuget:?package=Aspire.Hosting.Python&version=13.6.0
Python hosting integration
Use this integration to model, configure, and orchestrate Python scripts, modules, and web applications in an Aspire solution.
Getting started
Prerequisites
The example uses uv, which must be installed and available on PATH. The Python application directory must contain a pyproject.toml that declares Uvicorn and the application's dependencies, such as FastAPI.
Add the integration
From your AppHost directory, add the Aspire.Hosting.Python integration with the Aspire CLI:
aspire add Aspire.Hosting.Python
Usage example
Then, in the AppHost, add a Python web application and reference it from another resource with either C# or TypeScript. This example assumes ../python-api/main.py defines an ASGI application named app:
C#
var builder = DistributedApplication.CreateBuilder(args);
var python = builder.AddUvicornApp("python-api", "../python-api", "main:app")
.WithUv();
builder.AddProject<Projects.WebFrontend>("web")
.WithReference(python)
.WaitFor(python);
builder.Build().Run();
TypeScript
import { createBuilder } from "./.aspire/modules/aspire.mjs";
const builder = await createBuilder();
const python = await builder.addUvicornApp("python-api", "../python-api", "main:app")
.withUv();
await builder.addProject("web", "../WebFrontend/WebFrontend.csproj")
.withReference(python)
.waitFor(python);
await builder.build().run();
AddUvicornApp configures an HTTP endpoint and enables reload during local development. WithUv runs uv sync to prepare the virtual environment and install dependencies before the application starts.
For a script instead of an ASGI web application, use AddPythonApp("python", "../python-app", "main.py"). Use AddPythonModule to run a module with python -m.
Additional documentation
- https://aspire.dev/integrations/gallery/
- https://aspire.dev/integrations/frameworks/python/
- https://docs.python.org/3/
- https://docs.astral.sh/uv/
- https://uvicorn.dev/
Feedback & contributing
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Aspire.Hosting (>= 13.6.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Google.Protobuf (>= 3.36.1)
- Grpc.AspNetCore (>= 2.83.0)
- Grpc.Net.ClientFactory (>= 2.83.0)
- Grpc.Tools (>= 2.83.0)
- Hex1b (>= 0.168.0)
- KubernetesClient (>= 19.0.2)
- MessagePack (>= 2.5.302)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.31)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Http (>= 10.0.12)
- Microsoft.Extensions.Logging (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Extensions.Primitives (>= 10.0.12)
- ModelContextProtocol (>= 1.4.1)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- Polly.Core (>= 8.7.0)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.25.29)
- System.IO.Hashing (>= 10.0.12)
- System.Text.Json (>= 10.0.12)
- YamlDotNet (>= 18.1.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Aspire.Hosting.Python:
| Package | Downloads |
|---|---|
|
CommunityToolkit.Aspire.Hosting.Python.Extensions
An Aspire integration for hosting Uvicorn apps. |
|
|
ZYC.Framework.Modules.Aspire.KMS
PyKMS hosting module for ZYC.Framework Aspire. |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Aspire.Hosting.Python:
| Repository | Stars |
|---|---|
|
microsoft/aspire-samples
Browse the sample apps demonstrating Aspire integration across C#, JavaScript, TypeScript, Python, Go, containers, databases, cloud, AI, and observability scenarios.
|
|
|
CommunityToolkit/Aspire
A community project with additional components and extensions for Aspire
|
|
|
nightscout/nocturne
A next-generation platform for diabetes management
|
| Version | Downloads | Last Updated |
|---|---|---|
| 13.6.0 | 5 | 9/29/2026 |
| 13.5.4 | 8,271 | 9/15/2026 |
| 13.5.3 | 12,805 | 8/25/2026 |
| 13.5.2 | 3,408 | 8/21/2026 |
| 13.5.1 | 968 | 8/20/2026 |
| 13.5.0 | 14,047 | 8/18/2026 |
| 13.4.6 | 45,793 | 6/19/2026 |
| 13.4.5 | 2,760 | 6/17/2026 |
| 13.4.4 | 2,972 | 6/15/2026 |
| 13.4.3 | 8,117 | 6/8/2026 |
| 13.4.2 | 5,240 | 6/3/2026 |
| 13.4.1 | 406 | 6/3/2026 |
| 13.4.0 | 9,306 | 6/1/2026 |
| 13.3.5 | 7,600 | 5/21/2026 |
| 13.3.4 | 905 | 5/19/2026 |
| 13.3.3 | 5,330 | 5/15/2026 |
| 13.3.2 | 3,480 | 5/14/2026 |
| 13.3.1 | 902 | 5/12/2026 |
| 13.3.0 | 12,628 | 5/7/2026 |
| 13.2.4 | 15,868 | 4/24/2026 |