Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 6, 2025

Adds AddStreamlitApp() extension method to host Streamlit applications in Aspire, using the Aspire.Hosting.Python integration.

Implementation

  • StreamlitAppResource: Resource definition inheriting from PythonAppResource with service discovery support
  • StreamlitAppHostingExtension: Extension method using AddPythonExecutable from Aspire.Hosting.Python
    • Configures Streamlit server with proper port, address, and headless mode settings
    • Supports virtual environment management via WithPip(), WithUv(), and WithVirtualEnvironment()
  • Experimental Status: Marked with [Experimental("CTASPIRE001")] attribute as it relies on patterns that will be publicly exposed in Aspire 13.1

Usage

builder.AddStreamlitApp("myapp", "../path/to/app", "app.py")
    .WithHttpEndpoint(env: "PORT")
    .WithHttpHealthCheck("/health");

Note: This integration is experimental and subject to change. The implementation will be updated when AddPythonAppCore becomes publicly available in Aspire.Hosting.Python (expected in Aspire 13.1).

Testing

Original prompt

This section details on the original issue you should resolve

<issue_title>Add Streamlit to PythonExtention</issue_title>
<issue_description>### Related to an existing integration?

Yes

Existing integration

CommunityToolkit.Aspire.Hosting.Python.Extensions

Overview

We should add support in the Python Extension for streamlit. The extension is basically a wrapper around AddExecutable with the hardcoded command streamlit. A streamlit app is executed by running
streamlit run your_file.py, so we want to probably use the same structure we use for golang.

Usage example

The first parameter is of course the aspire resource name. Second param is the working directory and third param is the python file to be run by streamlit.

builder.AddStreamlitApp("myapp", "../path/to/app", "app.py")
    .WithHttpEndpoint(env: "PORT")
    .WithHttpHealthCheck("/health");

Breaking change?

No

Alternatives

You can use AddExecutable to manually set the commands.

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item</issue_description>

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

Custom agent used: Hosting Integration Creator
This agent helps users create new hosting integration in Aspire by scaffolding the correct projects and files based on user input.


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

Copilot AI and others added 3 commits November 6, 2025 08:01
Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Streamlit support to Python extension Add Streamlit support to Python Extensions Nov 6, 2025
Copilot AI requested a review from tommasodotNET November 6, 2025 08:09
Copilot finished work on behalf of tommasodotNET November 6, 2025 08:09
@tommasodotNET
Copy link
Contributor

@copilot work on the review comments

…ecutable

Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
Copilot AI requested a review from tommasodotNET November 6, 2025 08:34
Copilot finished work on behalf of tommasodotNET November 6, 2025 08:34
@tommasodotNET tommasodotNET marked this pull request as ready for review November 6, 2025 08:38
Copilot AI review requested due to automatic review settings November 6, 2025 08:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Streamlit support to the Python Extensions for .NET Aspire, allowing developers to host Streamlit applications within Aspire. This includes the resource definition, hosting extension methods, example application, and tests.

  • Adds StreamlitAppResource and StreamlitAppHostingExtension for Streamlit support
  • Includes a working example Streamlit application with proper setup documentation
  • Adds test coverage for both resource creation and integration testing

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
StreamlitAppResource.cs Defines the Streamlit application resource model
StreamlitAppHostingExtension.cs Provides extension methods to add Streamlit apps to the app builder
ResourceCreationTests.cs Adds unit test for Streamlit resource creation
AppHostTests.cs Adds integration test for Streamlit app startup
README.md (extensions) Documents Streamlit usage example
Program.cs (AppHost) Adds Streamlit app to the example host
streamlit-api/* Example Streamlit application with dependencies and documentation

tommasodotNET and others added 2 commits November 6, 2025 11:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tAppHostingExtension.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… as experimental

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot AI changed the title Add Streamlit support to Python Extensions Add Streamlit support to Python Extensions (Experimental) Nov 11, 2025
Copilot AI requested a review from aaronpowell November 11, 2025 01:07
Copilot finished work on behalf of aaronpowell November 11, 2025 01:07
/// </code>
/// </example>
[Experimental("CTASPIRE001", UrlFormat = "https://github.com/CommunityToolkit/Aspire/issues/{0}")]
public static IResourceBuilder<StreamlitAppResource> AddStreamlitApp(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does debugging and deploying work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't invest in that until 13.1 when we can drop our implementation of the internals of the Python integration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make sure it works. The bar should be higher in 13 for new language / framework integrations. Even if it doesn't work I don't want us to merge things without understanding what works and what doesn't work. I'd expect the future to look like a set of capabililities for these language integrations (otel support, endpoints, https, dockerfile, debugging). Doing enough work to know what we will document is a minimum bar here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I appreciate the desire, we have to work with the realities of the OSS project - we don't have the resources to do everything that Aspire does.

The goal is to do our best to be producing high quality integrations to the level of Aspire, but it's not always going to be the case, especially if we want to ship. Feel free to raise an issue to get debugger support enabled, but I don't see it as a blocker for us shipping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok let me ask then. Does it work when you run locally and deploy? If it doesn’t? Do we know why? Has anyone built an app with this PR?

@aaronpowell aaronpowell added this to the 13 milestone Nov 11, 2025
@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.GoFeatureFlag 100% 97% 74
CommunityToolkit.Aspire.Hosting.ActiveMQ 78% 40% 108
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% 37% 840
CommunityToolkit.Aspire.Hosting.DbGate 94% 50% 18
CommunityToolkit.Aspire.Hosting.Deno 98% 85% 44
CommunityToolkit.Aspire.Hosting.Flagd 79% 100% 32
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 87% 73% 36
CommunityToolkit.Aspire.Hosting.Golang 87% 70% 28
CommunityToolkit.Aspire.Hosting.Java 70% 75% 130
CommunityToolkit.Aspire.Hosting.JavaScript.Extensions 97% 85% 200
CommunityToolkit.Aspire.Hosting.k6 58% 12% 20
CommunityToolkit.Aspire.Hosting.Keycloak.Extensions 100% 100% 22
CommunityToolkit.Aspire.Hosting.KurrentDB 71% 75% 34
CommunityToolkit.Aspire.Hosting.LavinMQ 74% 50% 26
CommunityToolkit.Aspire.Hosting.LavinMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.MailPit 85% 50% 22
CommunityToolkit.Aspire.Hosting.McpInspector 75% 39% 150
CommunityToolkit.Aspire.Hosting.Meilisearch 71% 57% 58
CommunityToolkit.Aspire.Hosting.Minio 88% 75% 56
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.Ollama 65% 70% 200
CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector 78% 61% 77
CommunityToolkit.Aspire.Hosting.PapercutSmtp 81% 50% 18
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 99% 89% 84
CommunityToolkit.Aspire.Hosting.Python.Extensions 45% 29% 100
CommunityToolkit.Aspire.Hosting.RavenDB 62% 48% 148
CommunityToolkit.Aspire.Hosting.Redis.Extensions 100% 71% 48
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 16
CommunityToolkit.Aspire.Hosting.Solr 72% 100% 22
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 52% 49% 206
CommunityToolkit.Aspire.Hosting.Sqlite 89% 89% 52
CommunityToolkit.Aspire.Hosting.SqlServer.Extensions 100% 87% 78
CommunityToolkit.Aspire.Hosting.SurrealDb 55% 40% 256
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 90% 85% 112
CommunityToolkit.Aspire.OllamaSharp 77% 71% 132
CommunityToolkit.Aspire.RavenDB.Client 60% 53% 237
CommunityToolkit.Aspire.SurrealDb 79% 63% 78
Summary 68% (7067 / 10350) 56% (2012 / 3590) 4574

Minimum allowed line rate is 60%

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.

Add Streamlit to PythonExtention

4 participants