-
Notifications
You must be signed in to change notification settings - Fork 0
Add Streamlit Hello World microservice with modular structure #2
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
base: main
Are you sure you want to change the base?
Conversation
- Add app.py with Streamlit UI showing Hello World and personalized greeting - Add service/greeting.py with greet() function and logging - Add tests/test_greeting.py with comprehensive test coverage - Add requirements.txt with streamlit and pytest - Add Dockerfile with Python 3.11-slim base image - Add Makefile with install, run, test, docker-build, docker-run targets - Update README.md with complete documentation in Spanish - Update .gitignore to include .DS_Store for macOS Co-authored-by: svg153 <9192031+svg153@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 implements a basic Streamlit microservice with greeting functionality in Python 3.11, including a complete project structure with service layer, tests, Docker support, and comprehensive Spanish documentation.
Key Changes:
- Streamlit web application with "Hello World" display and personalized greeting input
- Service layer with logging for greeting generation
- Complete test suite with 4 tests covering various scenarios
Reviewed Changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app.py | Main Streamlit application entry point with UI components |
| service/greeting.py | Greeting service implementation with INFO-level logging |
| service/init.py | Service module exports for clean imports |
| tests/test_greeting.py | Test suite for greeting service functionality |
| tests/init.py | Test package initialization |
| requirements.txt | Project dependencies (Streamlit 1.40.2, pytest 8.3.4) |
| Dockerfile | Docker configuration using Python 3.11-slim |
| Makefile | Build automation with install, run, test, and docker targets |
| README.md | Comprehensive Spanish documentation with quick start guide |
| .gitignore | Added macOS .DS_Store exclusion |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Configure logging | ||
| logging.basicConfig( | ||
| level=logging.INFO, | ||
| format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' | ||
| ) |
Copilot
AI
Nov 15, 2025
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.
Calling logging.basicConfig() at module level can cause conflicts when the module is imported into applications that configure their own logging (like Streamlit). This may lead to duplicate log messages or configuration conflicts. Consider removing the basicConfig call and letting the application configure logging, or check if logging is already configured before calling basicConfig using if not logging.getLogger().hasHandlers().
| # Configure logging | |
| logging.basicConfig( | |
| level=logging.INFO, | |
| format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' | |
| ) | |
| # Configure logging only if not already configured | |
| if not logging.getLogger().hasHandlers(): | |
| logging.basicConfig( | |
| level=logging.INFO, | |
| format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' | |
| ) |
| with caplog.at_level(logging.INFO): | ||
| greet("Test") | ||
|
|
||
| assert len(caplog.records) == 1 |
Copilot
AI
Nov 15, 2025
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.
The assertion len(caplog.records) == 1 is fragile because if logging.basicConfig() is called multiple times (e.g., when running multiple tests), it may create additional log handlers leading to duplicate log records. This could cause the test to fail unexpectedly. Consider using assert len(caplog.records) >= 1 or filtering records by logger name to make the test more robust.
| assert len(caplog.records) == 1 | |
| assert len(caplog.records) >= 1 |
Implements a minimal Streamlit microservice displaying "Hello World" and personalized greetings, structured for future extension.
Structure
Implementation
Service Layer (
service/greeting.py):Streamlit App (
app.py):Docker (port 8501):
Screenshots
Initial View:

Personalized Greeting:

Quick Start
No security vulnerabilities detected (CodeQL, Advisory DB).
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:
checkip.amazonaws.com/usr/bin/python3 /home/REDACTED/.local/bin/streamlit run app.py --server.headless=true --server.port=8501(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Automated by Copilot MCP Server
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.