-
Notifications
You must be signed in to change notification settings - Fork 142
Add Streamlit support to Python Extensions (Experimental) #954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
src/CommunityToolkit.Aspire.Hosting.Python.Extensions/StreamlitAppResource.cs
Show resolved
Hide resolved
|
@copilot work on the review comments |
…ecutable Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
There was a problem hiding this 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
StreamlitAppResourceandStreamlitAppHostingExtensionfor 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 |
src/CommunityToolkit.Aspire.Hosting.Python.Extensions/StreamlitAppHostingExtension.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Python.Extensions/StreamlitAppHostingExtension.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Python.Extensions/README.md
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Python.Extensions/StreamlitAppHostingExtension.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Python.Extensions/StreamlitAppHostingExtension.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tAppHostingExtension.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
src/CommunityToolkit.Aspire.Hosting.Python.Extensions/StreamlitAppHostingExtension.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Aspire.Hosting.Python.Extensions/StreamlitAppHostingExtension.cs
Outdated
Show resolved
Hide resolved
… as experimental Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
| /// </code> | ||
| /// </example> | ||
| [Experimental("CTASPIRE001", UrlFormat = "https://github.com/CommunityToolkit/Aspire/issues/{0}")] | ||
| public static IResourceBuilder<StreamlitAppResource> AddStreamlitApp( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
Minimum allowed line rate is |
Adds
AddStreamlitApp()extension method to host Streamlit applications in Aspire, using the Aspire.Hosting.Python integration.Implementation
StreamlitAppResource: Resource definition inheriting fromPythonAppResourcewith service discovery supportStreamlitAppHostingExtension: Extension method usingAddPythonExecutablefrom Aspire.Hosting.PythonWithPip(),WithUv(), andWithVirtualEnvironment()[Experimental("CTASPIRE001")]attribute as it relies on patterns that will be publicly exposed in Aspire 13.1Usage
Note: This integration is experimental and subject to change. The implementation will be updated when
AddPythonAppCorebecomes publicly available in Aspire.Hosting.Python (expected in Aspire 13.1).Testing
Added unit test validating resource creation
Added integration test to AppHost example (currently skipped per issue Review the Python extensions relative to the new Python hosting integration #917)
Included minimal Streamlit example app in
examples/python/streamlit-api/Experimental diagnostic warnings suppressed in tests and examples
Fixes Add Streamlit to PythonExtention #953
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.