Skip to content

Conversation

Copy link

Copilot AI commented Nov 15, 2025

Implements a minimal Streamlit microservice displaying "Hello World" and personalized greetings, structured for future extension.

Structure

├── app.py                    # Streamlit UI
├── service/
│   └── greeting.py           # greet(name: str) -> str with INFO logging
├── tests/
│   └── test_greeting.py      # 4 tests covering core functionality
├── requirements.txt          # streamlit==1.40.2, pytest==8.3.4
├── Dockerfile                # python:3.11-slim
├── Makefile                  # install, run, test, docker-build, docker-run
└── README.md                 # Quick start in Spanish

Implementation

Service Layer (service/greeting.py):

def greet(name: str) -> str:
    logger.info(f"Greeting generated for: {name}")
    return f"Hola, {name}"

Streamlit App (app.py):

  • Displays static "Hello World" message
  • Text input for personalized greetings
  • Calls service layer with logging

Docker (port 8501):

FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0"]

Screenshots

Initial View:
Hello World

Personalized Greeting:
Greeting with name

Quick Start

make install && make run
# or
make docker-build && make docker-run

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
    • Triggering command: /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

Requisitos:

  1. Lenguaje: Python 3.11.
  2. Framework web: Streamlit.
  3. Funcionalidad mínima: Mostrar 'Hello World' y permitir ingresar un nombre para saludar ("Hola, ").
  4. Estructura propuesta:
    /app.py
    /service/init.py
    /service/greeting.py (función greet(name: str) -> str )
    /tests/test_greeting.py
    /requirements.txt (streamlit==, pytest)
    /Dockerfile
    /Makefile
    /README.md
  5. Dockerfile: usar python:3.11-slim, crear venv opcional o instalar directamente, ejecutar streamlit.
  6. Puerto: 8501 (por defecto de Streamlit).
  7. Logging básico en greeting (INFO cuando se saluda).
  8. Makefile targets: install (pip install -r requirements.txt), run (streamlit run app.py), test (pytest -q), docker-build, docker-run.
  9. README: instrucciones rápidas (instalación, ejecución local, docker, tests).
  10. Mantener código y documentación mínimas sin redundancia.
  11. Añadir .gitignore para Python, venv, pycache, .pytest_cache, .DS_Store.
  12. Preparado para extender luego (microservicio futuro) => estructura clara.
  13. Evitar dependencias innecesarias.
  14. Licencia MIT corta.
    Objetivo: Entregar repo listo para clonar y mostrar en demo en menos de 1 minuto.

Related to Issue #1

Custom agent used: README Expert
Agente experto en crear READMEs atractivos, informativos y bien estructurados para proyectos de desarrollo.

Automated by Copilot MCP Server


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

- 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>
@svg153 svg153 requested a review from Copilot November 15, 2025 12:09
Copilot finished reviewing on behalf of svg153 November 15, 2025 12:10
Copy link

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 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.

Comment on lines +4 to +8
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
Copy link

Copilot AI Nov 15, 2025

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().

Suggested change
# 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'
)

Copilot uses AI. Check for mistakes.
with caplog.at_level(logging.INFO):
greet("Test")

assert len(caplog.records) == 1
Copy link

Copilot AI Nov 15, 2025

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.

Suggested change
assert len(caplog.records) == 1
assert len(caplog.records) >= 1

Copilot uses AI. Check for mistakes.
Copilot AI changed the title [WIP] Add basic Streamlit app with greeting functionality Add Streamlit Hello World microservice with modular structure Nov 15, 2025
Copilot finished work on behalf of svg153 November 15, 2025 12:11
Copilot AI requested a review from svg153 November 15, 2025 12:11
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.

2 participants