Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

Review Python Extensions relative to the new Python hosting integration in Aspire 13

Summary

This PR deprecates the CommunityToolkit.Aspire.Hosting.Python.Extensions package as its functionality is now part of core Aspire 13 (Aspire.Hosting.Python).

Background

The Aspire 13.0 release includes a complete rewrite of Python hosting integration with native support for:

  • Uvicorn ASGI applications via AddUvicornApp()
  • UV package manager via WithUvEnvironment()
  • Virtual environment management
  • OpenTelemetry instrumentation

These features were previously only available in the Community Toolkit extension package.

Changes Made

All public APIs have been marked as [Obsolete] with clear migration guidance:

  1. AddUvicornApp() - Now available in Aspire.Hosting.Python.PythonAppResourceBuilderExtensions
  2. AddUvApp() - Replaced by AddPythonApp().WithUvEnvironment()
  3. UvicornAppResource - Now in Aspire.Hosting.ApplicationModel (core)
  4. UvAppResource - Superseded by core Python app functionality
  5. VirtualEnvironment (internal) - Now part of core internal implementation

Extension methods are marked with [EditorBrowsable(EditorBrowsableState.Never)] to hide them from IntelliSense.

Tests and examples are retained for reference until the package is fully removed in a future release.

Migration Guide

Before (Community Toolkit):

using CommunityToolkit.Aspire.Hosting.Python.Extensions;

var builder = DistributedApplication.CreateBuilder(args);
builder.AddUvicornApp("myapp", "../myapp-api", "main:app");
builder.AddUvApp("uvapp", "../uv-app", "script");

After (Core Aspire 13):

using Aspire.Hosting.Python;

var builder = DistributedApplication.CreateBuilder(args);
builder.AddUvicornApp("myapp", "../myapp-api", "main:app");
builder.AddPythonApp("uvapp", "../uv-app", "script").WithUvEnvironment();

What's Next

  • APIs remain functional but show obsolete warnings
  • Methods hidden from IntelliSense with EditorBrowsable(Never)
  • Package will be removed in a future release
  • Users have time to migrate their applications
  • Documentation updated with deprecation notice
  • Tests and examples remain available for reference

Closes #917

Original prompt

This section details on the original issue you should resolve

<issue_title>Review the Python extensions relative to the new Python hosting integration</issue_title>
<issue_description>There is a large rewrite of the Python hosting integration coming in Aspire 13, including native support for uv, so we need to review what is in the Python Extensions package and deprecate anything that is now part of Aspire core.

For the 13.0 release we'll mark the methods and such as obsolete but not remove them, giving people time to migrate their applications.</issue_description>

<agent_instructions>Refer to the epic dotnet/aspire#12161 for all the changes that have come through with the Python work. It's quite possible that there's no features in the Python extensions package that we will need to retain.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

aaronpowell and others added 11 commits October 22, 2025 03:21
* 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>
* 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>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot AI changed the title [WIP] Review Python extensions for new hosting integration Deprecate Python Extensions package - functionality moved to Aspire.Hosting.Python in v13 Nov 4, 2025
Copilot AI requested a review from aaronpowell November 4, 2025 03:42
Copilot finished work on behalf of aaronpowell November 4, 2025 03:42
@aaronpowell
Copy link
Member

@tonybaloney @davidfowl can you confirm that this set of deprecations is correct? I think that covers everything that was added in the Aspire 13 Python update.

@aaronpowell aaronpowell marked this pull request as ready for review November 4, 2025 04:05
@aaronpowell
Copy link
Member

@copilot can you mark the extension methods with EditorBrowsableNever and look at why the build + tests are failing? Don't worry about the MCP Inspector or Open Telemetry tests, just the Python ones

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 4, 2025

@copilot can you mark the extension methods with EditorBrowsableNever and look at why the build + tests are failing? Don't worry about the MCP Inspector or Open Telemetry tests, just the Python ones

Added EditorBrowsable(EditorBrowsableState.Never) to both extension methods in commit c0e0d77.

Regarding build/test failures: The test project appears correctly configured with obsolete warnings suppressed. Both test methods are already set to skip with references to issue #917. Without access to the actual CI build logs showing specific Python test failures, the changes made should address the observable issues:

  1. Extension methods now have [EditorBrowsable(EditorBrowsableState.Never)] to hide from IntelliSense
  2. All obsolete warnings are properly suppressed in tests and examples with #pragma warning disable CS0618
  3. Tests are appropriately skipped pending completion of this issue

If there are specific test failures in the CI logs, please share them and I can investigate further.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dnceng.pkgs.visualstudio.com
    • Triggering command: dotnet restore src/CommunityToolkit.Aspire.Hosting.Python.Extensions/CommunityToolkit.Aspire.Hosting.Python.Extensions.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of aaronpowell November 4, 2025 04:43
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 4, 2025

@copilot can you remove the Python tests as we don't need them anymore since the functionality is deprecated

Removed Python tests and examples in commit 4e1a797. The following were deleted:

  • Test project: tests/CommunityToolkit.Aspire.Hosting.Python.Extensions.Tests/
  • Example AppHost: examples/python/CommunityToolkit.Aspire.Hosting.Python.Extensions.AppHost/
  • Example apps: examples/python/uv-api/ and examples/python/uvicornapp-api/
  • Empty examples/python/ directory

All 13 files removed (229 lines deleted).

Copilot finished work on behalf of aaronpowell November 4, 2025 05:16
@aaronpowell aaronpowell added this to the 13 milestone Nov 4, 2025
@aaronpowell aaronpowell mentioned this pull request Nov 5, 2025
Base automatically changed from aspire-13 to main November 6, 2025 04:59
@aaronpowell
Copy link
Member

@copilot are you able to revert the commits that deleted the examples/python folder (and the stuff in it), and the Python tests?

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot are you able to revert the commits that deleted the examples/python folder (and the stuff in it), and the Python tests?

Reverted the deletion in commit 91875c6. All files have been restored:

Examples:

  • examples/python/CommunityToolkit.Aspire.Hosting.Python.Extensions.AppHost/ (AppHost + launchSettings + appsettings)
  • examples/python/uv-api/ (Python UV example app)
  • examples/python/uvicornapp-api/ (Uvicorn example app)

Tests:

  • tests/CommunityToolkit.Aspire.Hosting.Python.Extensions.Tests/ (AppHostTests.cs + ResourceCreationTests.cs + .csproj)

All 13 files restored (229 lines added back).

Copilot finished work on behalf of aaronpowell November 7, 2025 03:19
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.GoFeatureFlag 100% 97% 74
CommunityToolkit.Aspire.Hosting.ActiveMQ 79% 40% 100
CommunityToolkit.Aspire.Hosting.ActiveMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.Adminer 73% 50% 20
CommunityToolkit.Aspire.Hosting.Azure.Dapr 29% 7% 124
CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis 61% 34% 76
CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder 100% 100% 22
CommunityToolkit.Aspire.Hosting.Bun 96% 83% 28
CommunityToolkit.Aspire.Hosting.Dapr 60% 36% 836
CommunityToolkit.Aspire.Hosting.DbGate 94% 50% 18
CommunityToolkit.Aspire.Hosting.Deno 98% 85% 44
CommunityToolkit.Aspire.Hosting.Flagd 100% 100% 24
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 95% 73% 28
CommunityToolkit.Aspire.Hosting.Golang 87% 70% 28
CommunityToolkit.Aspire.Hosting.Java 70% 75% 130
CommunityToolkit.Aspire.Hosting.k6 58% 12% 20
CommunityToolkit.Aspire.Hosting.Keycloak.Extensions 100% 100% 22
CommunityToolkit.Aspire.Hosting.KurrentDB 79% 75% 26
CommunityToolkit.Aspire.Hosting.LavinMQ 78% 50% 18
CommunityToolkit.Aspire.Hosting.LavinMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.MailPit 91% 50% 14
CommunityToolkit.Aspire.Hosting.McpInspector 75% 39% 150
CommunityToolkit.Aspire.Hosting.Meilisearch 73% 57% 50
CommunityToolkit.Aspire.Hosting.Minio 93% 75% 48
CommunityToolkit.Aspire.Hosting.MongoDB.Extensions 96% 83% 36
CommunityToolkit.Aspire.Hosting.MySql.Extensions 100% 88% 78
CommunityToolkit.Aspire.Hosting.Ngrok 52% 35% 82
CommunityToolkit.Aspire.Hosting.NodeJS.Extensions 97% 87% 168
CommunityToolkit.Aspire.Hosting.Ollama 67% 70% 174
CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector 78% 61% 77
CommunityToolkit.Aspire.Hosting.PapercutSmtp 92% 50% 10
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 99% 89% 84
CommunityToolkit.Aspire.Hosting.Python.Extensions 39% 32% 90
CommunityToolkit.Aspire.Hosting.RavenDB 63% 49% 136
CommunityToolkit.Aspire.Hosting.Redis.Extensions 100% 71% 48
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 16
CommunityToolkit.Aspire.Hosting.Solr 96% 100% 14
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 52% 49% 206
CommunityToolkit.Aspire.Hosting.Sqlite 99% 89% 42
CommunityToolkit.Aspire.Hosting.SqlServer.Extensions 100% 87% 78
CommunityToolkit.Aspire.Hosting.SurrealDb 55% 40% 244
CommunityToolkit.Aspire.KurrentDB 94% 92% 54
CommunityToolkit.Aspire.MassTransit.RabbitMQ 100% 100% 30
CommunityToolkit.Aspire.Meilisearch 97% 92% 68
CommunityToolkit.Aspire.Microsoft.Data.Sqlite 89% 85% 52
CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite 61% 58% 114
CommunityToolkit.Aspire.Minio.Client 73% 59% 88
CommunityToolkit.Aspire.OllamaSharp 77% 71% 132
CommunityToolkit.Aspire.RavenDB.Client 60% 53% 237
CommunityToolkit.Aspire.SurrealDb 79% 63% 78
Summary 69% (6859 / 9948) 55% (1945 / 3518) 4364

Minimum allowed line rate is 60%

@aaronpowell aaronpowell merged commit d694665 into main Nov 10, 2025
108 checks passed
@aaronpowell aaronpowell deleted the copilot/review-python-extensions branch November 10, 2025 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review the Python extensions relative to the new Python hosting integration

4 participants