Skip to content

Commit d694665

Browse files
Copilotaaronpowell
andauthored
Deprecate Python Extensions package - functionality moved to Aspire.Hosting.Python in v13 (#945)
* baseline branch for the next major release * Updating nightly * Remove deprecated IDistributedApplicationLifecycleHook interface (#915) * Initial plan * Replace IDistributedApplicationLifecycleHook with event-based patterns Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Add tests for installer resources and update Dapr tests Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Refactor Dapr to use IDistributedApplicationEventingSubscriber Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Fixing build issue * Updating the endpoint port * Disabling some tests so we can move forward in other parts of the Aspire 13 update --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> Co-authored-by: Aaron Powell <me@aaron-powell.com> * Adjusting the version of keycloak * Updating aspire nightly * New nightly * Remove npm functionality moved to Aspire 13 (#928) * Initial plan * Remove AddViteApp and npm-specific functionality (moved to Aspire 13) Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Update comments and tests to reflect npm removal Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Update MONOREPO.md to remove npm references Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Adding missing types * Bad copilot code * Fixing missing namespace * Handling port forwarding * removing more stuff that has been migrated to aspire core * Reworking how package installing is handled * daily update * Adding back the annotation that is no longer moving to core * Forgot to install packages * adding a bunch more annotations to provide enough metadata * Removing old demo apps * Disabling python tests * Removing a testing change * Updating to the latest nightly and dealing with type name changes * Removing type that was can repurpose from aspire core * breaking the tests down so they are easier to read * Removing legacy docs * Fixing failing tests --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> Co-authored-by: Aaron Powell <me@aaron-powell.com> * Initial plan * Mark Python Extensions APIs as obsolete for Aspire 13 Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Add EditorBrowsable(Never) to obsolete extension methods Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Fixing failing test * Remove deprecated Python tests and examples Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Fixing compiler issues * Removing Python tests from the list * Dropping a namespace * Revert deletion of Python examples and tests Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Fixing test list --------- Co-authored-by: Aaron Powell <me@aaron-powell.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
1 parent 7246c77 commit d694665

File tree

11 files changed

+38
-18
lines changed

11 files changed

+38
-18
lines changed

.github/workflows/tests.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ jobs:
3333
Hosting.GoFeatureFlag.Tests,
3434
Hosting.Golang.Tests,
3535
Hosting.Java.Tests,
36-
Hosting.Keycloak.Extensions.Tests,
3736
Hosting.k6.Tests,
37+
Hosting.Keycloak.Extensions.Tests,
3838
Hosting.KurrentDB.Tests,
3939
Hosting.LavinMQ.Tests,
4040
Hosting.MailPit.Tests,
4141
Hosting.McpInspector.Tests,
4242
Hosting.Meilisearch.Tests,
43+
Hosting.Minio.Tests,
4344
Hosting.MongoDB.Extensions.Tests,
4445
Hosting.MySql.Extensions.Tests,
4546
Hosting.Ngrok.Tests,
@@ -55,9 +56,8 @@ jobs:
5556
Hosting.Rust.Tests,
5657
Hosting.Solr.Tests,
5758
Hosting.SqlDatabaseProjects.Tests,
58-
Hosting.SqlServer.Extensions.Tests,
5959
Hosting.Sqlite.Tests,
60-
Hosting.Minio.Tests,
60+
Hosting.SqlServer.Extensions.Tests,
6161
Hosting.SurrealDb.Tests,
6262

6363
# Client integration tests
@@ -67,9 +67,9 @@ jobs:
6767
Meilisearch.Tests,
6868
Microsoft.Data.Sqlite.Tests,
6969
Microsoft.EntityFrameworkCore.Sqlite.Tests,
70+
Minio.Client.Tests,
7071
OllamaSharp.Tests,
7172
RavenDB.Client.Tests,
72-
Minio.Client.Tests,
7373
SurrealDb.Tests,
7474
]
7575

CommunityToolkit.Aspire.slnx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@
5959
<Project Path="examples/k6/CommunityToolkit.Aspire.Hosting.k6.ServiceDefaults/CommunityToolkit.Aspire.Hosting.k6.ServiceDefaults.csproj" />
6060
</Folder>
6161
<Folder Name="/examples/keycloak-postgres/">
62-
<Project Path="examples\keycloak-postgres\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.AppHost\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.AppHost.csproj" Type="C#" />
63-
<Project Path="examples\keycloak-postgres\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Dev\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Dev.csproj" Type="C#" />
64-
<Project Path="examples\keycloak-postgres\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Prod\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Prod.csproj" Type="C#" />
65-
<Project Path="examples\keycloak-postgres\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.ServiceDefaults\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.ServiceDefaults.csproj" Type="C#" />
62+
<Project Path="examples\keycloak-postgres\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.AppHost\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.AppHost.csproj" />
63+
<Project Path="examples\keycloak-postgres\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Dev\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Dev.csproj" />
64+
<Project Path="examples\keycloak-postgres\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Prod\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Prod.csproj" />
65+
<Project Path="examples\keycloak-postgres\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.ServiceDefaults\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.ServiceDefaults.csproj" />
6666
</Folder>
6767
<Folder Name="/examples/lavinmq/">
6868
<Project Path="examples/lavinmq/CommunityToolkit.Aspire.Hosting.LavinMQ.AppHost/CommunityToolkit.Aspire.Hosting.LavinMQ.AppHost.csproj" />
@@ -130,9 +130,6 @@
130130
<Folder Name="/examples/powershell/">
131131
<Project Path="examples/powershell/CommunityToolkit.Aspire.PowerShell.AppHost/CommunityToolkit.Aspire.PowerShell.AppHost.csproj" />
132132
</Folder>
133-
<Folder Name="/examples/python/">
134-
<Project Path="examples/python/CommunityToolkit.Aspire.Hosting.Python.Extensions.AppHost/CommunityToolkit.Aspire.Hosting.Python.Extensions.AppHost.csproj" />
135-
</Folder>
136133
<Folder Name="/examples/ravendb/">
137134
<Project Path="examples/ravendb/CommunityToolkit.Aspire.Hosting.RavenDB.ApiService/CommunityToolkit.Aspire.Hosting.RavenDB.ApiService.csproj" />
138135
<Project Path="examples/ravendb/CommunityToolkit.Aspire.Hosting.RavenDB.ServiceDefaults/CommunityToolkit.Aspire.Hosting.RavenDB.ServiceDefaults.csproj" />
@@ -211,7 +208,7 @@
211208
<Project Path="src/CommunityToolkit.Aspire.OllamaSharp/CommunityToolkit.Aspire.OllamaSharp.csproj" />
212209
<Project Path="src/CommunityToolkit.Aspire.RavenDB.Client/CommunityToolkit.Aspire.RavenDB.Client.csproj" />
213210
<Project Path="src/CommunityToolkit.Aspire.SurrealDb/CommunityToolkit.Aspire.SurrealDb.csproj" />
214-
<Project Path="src\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.csproj" Type="C#" />
211+
<Project Path="src\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions\CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.csproj" />
215212
</Folder>
216213
<Folder Name="/src/Dapr/">
217214
<Project Path="src/CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis/CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis.csproj" />
@@ -246,7 +243,6 @@
246243
<Project Path="tests/CommunityToolkit.Aspire.Hosting.PapercutSmtp.Tests/CommunityToolkit.Aspire.Hosting.PapercutSmtp.Tests.csproj" />
247244
<Project Path="tests/CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions.Tests/CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions.Tests.csproj" />
248245
<Project Path="tests/CommunityToolkit.Aspire.Hosting.PowerShell.Tests/CommunityToolkit.Aspire.Hosting.PowerShell.Tests.csproj" />
249-
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Python.Extensions.Tests/CommunityToolkit.Aspire.Hosting.Python.Extensions.Tests.csproj" />
250246
<Project Path="tests/CommunityToolkit.Aspire.Hosting.RavenDB.Tests/CommunityToolkit.Aspire.Hosting.RavenDB.Tests.csproj" />
251247
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Redis.Extensions.Tests/CommunityToolkit.Aspire.Hosting.Redis.Extensions.Tests.csproj" />
252248
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Rust.Tests/CommunityToolkit.Aspire.Hosting.Rust.Tests.csproj" />
@@ -256,7 +252,7 @@
256252
<Project Path="tests/CommunityToolkit.Aspire.Hosting.SqlServer.Extensions.Tests/CommunityToolkit.Aspire.Hosting.SqlServer.Extensions.Tests.csproj" />
257253
<Project Path="tests/CommunityToolkit.Aspire.Hosting.SurrealDb.Tests/CommunityToolkit.Aspire.Hosting.SurrealDb.Tests.csproj" />
258254
<Project Path="tests/CommunityToolkit.Aspire.KurrentDB.Tests/CommunityToolkit.Aspire.KurrentDB.Tests.csproj" />
259-
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Tests/CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Tests.csproj" Type="C#" />
255+
<Project Path="tests/CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Tests/CommunityToolkit.Aspire.Hosting.Keycloak.Extensions.Tests.csproj" />
260256
<Project Path="tests/CommunityToolkit.Aspire.MassTransit.RabbitMQ.Tests/CommunityToolkit.Aspire.MassTransit.RabbitMQ.Tests.csproj" />
261257
<Project Path="tests/CommunityToolkit.Aspire.Meilisearch.Tests/CommunityToolkit.Aspire.Meilisearch.Tests.csproj" />
262258
<Project Path="tests/CommunityToolkit.Aspire.Microsoft.Data.Sqlite.Tests/CommunityToolkit.Aspire.Microsoft.Data.Sqlite.Tests.csproj" />

examples/python/CommunityToolkit.Aspire.Hosting.Python.Extensions.AppHost/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#pragma warning disable CS0612
1+
#pragma warning disable CS0612 // Type or member is obsolete
2+
#pragma warning disable CS0618 // Type or member is obsolete
23
var builder = DistributedApplication.CreateBuilder(args);
34

45
builder.AddUvicornApp("uvicornapp", "../uvicornapp-api", "main:app");

src/CommunityToolkit.Aspire.Hosting.Python.Extensions/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# CommunityToolkit.Aspire.Hosting.Python.Extensions library
22

3+
> **⚠️ DEPRECATION NOTICE**
4+
> This package is deprecated as of Aspire 13.0. The functionality provided by this package is now part of the core `Aspire.Hosting.Python` package.
5+
>
6+
> **Migration Guide:**
7+
> - Replace `AddUvicornApp()` calls with `Aspire.Hosting.Python.PythonAppResourceBuilderExtensions.AddUvicornApp()`
8+
> - Replace `AddUvApp()` calls with `AddPythonApp().WithUvEnvironment()`
9+
> - Update resource type references from `CommunityToolkit.Aspire.Hosting.Python.Extensions.UvicornAppResource` to `Aspire.Hosting.ApplicationModel.UvicornAppResource`
10+
>
11+
> This package will be removed in a future release. Please migrate your applications to use the core `Aspire.Hosting.Python` package.
12+
313
Provides extensions methods and resource definitions for the .NET Aspire AppHost to extend the support for Python applications. Current support includes:
414
- Uvicorn
515
- Uv

src/CommunityToolkit.Aspire.Hosting.Python.Extensions/UvAppHostingExtension.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.ComponentModel;
12
using Aspire.Hosting.ApplicationModel;
23
using CommunityToolkit.Aspire.Utils;
34

@@ -18,6 +19,8 @@ public static class UvAppHostingExtension
1819
/// <param name="scriptArgs">Optional arguments to pass to the script.</param>
1920
/// <returns>An <see cref="IResourceBuilder{UvAppResource}"/> for the Uv application resource.</returns>
2021
/// <exception cref="ArgumentNullException">Thrown if <paramref name="builder"/> is null.</exception>
22+
[Obsolete("AddUvApp is now part of Aspire.Hosting.Python. Use Aspire.Hosting.Python.PythonAppResourceBuilderExtensions.AddPythonApp with WithUvEnvironment instead. This method will be removed in a future release.")]
23+
[EditorBrowsable(EditorBrowsableState.Never)]
2124
public static IResourceBuilder<UvAppResource> AddUvApp(
2225
this IDistributedApplicationBuilder builder,
2326
string name,
@@ -30,6 +33,7 @@ public static IResourceBuilder<UvAppResource> AddUvApp(
3033
return builder.AddUvApp(name, scriptPath, projectDirectory, ".venv", scriptArgs);
3134
}
3235

36+
[Obsolete]
3337
private static IResourceBuilder<UvAppResource> AddUvApp(this IDistributedApplicationBuilder builder,
3438
string name,
3539
string scriptPath,

src/CommunityToolkit.Aspire.Hosting.Python.Extensions/UvAppResource.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace Aspire.Hosting.ApplicationModel;
88
/// <param name="name">The name of the resource.</param>
99
/// <param name="executablePath">The path to the executable used to run the python app.</param>
1010
/// <param name="workingDirectory">The working directory for uv.</param>
11+
[Obsolete("UvAppResource is now superseded by functionality in Aspire.Hosting.Python. Use Aspire.Hosting.Python.PythonAppResourceBuilderExtensions.AddPythonApp with WithUvEnvironment instead. This class will be removed in a future release.")]
1112
public class UvAppResource(string name, string executablePath, string workingDirectory)
1213
: PythonAppResource(name, executablePath, workingDirectory), IResourceWithServiceDiscovery
1314
{

src/CommunityToolkit.Aspire.Hosting.Python.Extensions/UvicornAppHostingExtension.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Aspire.Hosting.ApplicationModel;
2-
using Aspire.Hosting.Python;
1+
using System.ComponentModel;
2+
using Aspire.Hosting.ApplicationModel;
33
using CommunityToolkit.Aspire.Utils;
44
using UvicornAppResource = Aspire.Hosting.ApplicationModel.UvicornAppResource;
55

@@ -20,6 +20,8 @@ public static class UvicornAppHostingExtension
2020
/// <param name="args">Optional arguments to pass to the script.</param>
2121
/// <returns>An <see cref="IResourceBuilder{UvicornAppResource}"/> for the Uvicorn application resource.</returns>
2222
/// <exception cref="ArgumentNullException">Thrown if <paramref name="builder"/> is null.</exception>
23+
[Obsolete("AddUvicornApp is now part of Aspire.Hosting.Python. Use the Aspire.Hosting.Python.PythonAppResourceBuilderExtensions.AddUvicornApp method instead. This method will be removed in a future release.")]
24+
[EditorBrowsable(EditorBrowsableState.Never)]
2325
public static IResourceBuilder<UvicornAppResource> AddUvicornApp(
2426
this IDistributedApplicationBuilder builder,
2527
[ResourceName] string name,
@@ -32,6 +34,7 @@ public static IResourceBuilder<UvicornAppResource> AddUvicornApp(
3234
return builder.AddUvicornApp(name, projectDirectory, appName, ".venv", args);
3335
}
3436

37+
[Obsolete]
3538
private static IResourceBuilder<UvicornAppResource> AddUvicornApp(this IDistributedApplicationBuilder builder,
3639
string name,
3740
string projectDirectory,

src/CommunityToolkit.Aspire.Hosting.Python.Extensions/UvicornAppResource.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ namespace Aspire.Hosting.ApplicationModel;
88
/// <param name="name">The name of the resource.</param>
99
/// <param name="executablePath">The path to the executable used to run the python app.</param>
1010
/// <param name="workingDirectory">The working directory for uvicorn.</param>
11+
[Obsolete("UvicornAppResource is now part of Aspire.Hosting.Python. Use Aspire.Hosting.ApplicationModel.UvicornAppResource instead. This class will be removed in a future release.")]
1112
public class UvicornAppResource(string name, string executablePath, string workingDirectory)
1213
: PythonAppResource(name, executablePath, workingDirectory), IResourceWithServiceDiscovery;

src/CommunityToolkit.Aspire.Hosting.Python.Extensions/VirtualEnvironment.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Aspire.Hosting.ApplicationModel;
44

5+
[Obsolete("VirtualEnvironment is now part of Aspire.Hosting.Python internal implementation. Use Aspire.Hosting.Python.PythonAppResourceBuilderExtensions.WithVirtualEnvironment or WithUvEnvironment instead. This class will be removed in a future release.")]
56
internal sealed class VirtualEnvironment(string virtualEnvironmentPath)
67
{
78
/// <summary>

tests/CommunityToolkit.Aspire.Hosting.Python.Extensions.Tests/AppHostTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace CommunityToolkit.Aspire.Hosting.Python.Extensions.Tests;
44

55
#pragma warning disable CTASPIRE001
6+
#pragma warning disable CS0612 // Type or member is obsolete
7+
#pragma warning disable CS0618 // Type or member is obsolete
68
public class AppHostTests(AspireIntegrationTestFixture<Projects.CommunityToolkit_Aspire_Hosting_Python_Extensions_AppHost> fixture) : IClassFixture<AspireIntegrationTestFixture<Projects.CommunityToolkit_Aspire_Hosting_Python_Extensions_AppHost>>
79
{
810
[Theory(Skip = "To be reviewed with https://github.com/CommunityToolkit/Aspire/issues/917")]

0 commit comments

Comments
 (0)