Skip to content

Handson-Copilot-Workshop-APAC/2025-github-ur-copilot-workshop

Β 
Β 

Repository files navigation

GitHub Copilot Workshop

This is a sample repository for GitHub Copilot Workshop.

Using the files in this repository, we created a fully functional Pomodoro Timer Web Application using Python (Flask), JavaScript, HTML, and CSS.

🎯 What is This Project?

A production-ready Pomodoro Timer web application that helps you stay focused and productive using the Pomodoro Technique. The app features:

  • ⏱️ 25-minute work sessions with short and long breaks
  • πŸ“Š Session tracking with visual progress indicators
  • βš™οΈ Customizable timers for work and break durations
  • πŸ“ Automatic logging of all sessions
  • πŸ”” Browser notifications when sessions complete
  • πŸ“± Responsive design that works on all devices

πŸ“š Documentation

πŸš€ Quick Start

Prerequisites

You need to have uv installed for this project.

Installing uv

uv is an extremely fast Python package and project manager, written in Rust. Install it using one of these methods:

macOS/Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows:

powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Or visit the official installation guide for more options.

Local Development Setup

  1. Clone the repository:

    git clone https://github.com/eComindo/2025-github-ur-copilot-workshop.git
    cd 2025-github-ur-copilot-workshop
  2. Create and activate virtual environment:

    uv venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  3. Install dependencies:

    uv pip install -r requirements.txt
  4. Run the application:

    cd pomodoro_app
    python app.py
  5. Open your browser: Navigate to http://127.0.0.1:5000

Deactivating Virtual Environment

When you're done working:

deactivate

πŸ“ Project Structure

2025-github-ur-copilot-workshop/
β”œβ”€β”€ pomodoro_app/           # Main application directory
β”‚   β”œβ”€β”€ app.py             # Flask backend server
β”‚   β”œβ”€β”€ static/            # CSS and JavaScript files
β”‚   β”‚   β”œβ”€β”€ style.css      # Application styling
β”‚   β”‚   └── timer.js       # Timer logic and UI interactions
β”‚   β”œβ”€β”€ templates/         # HTML templates
β”‚   β”‚   └── index.html     # Main application page
β”‚   β”œβ”€β”€ test_app.py        # Test suite
β”‚   β”œβ”€β”€ pomodoro_log.txt   # Session logs (generated)
β”‚   └── README.md          # App-specific documentation
β”œβ”€β”€ wsgi.py                # WSGI entry point for production
β”œβ”€β”€ startup.txt            # Azure deployment startup command
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ architecture.md        # Technical architecture
β”œβ”€β”€ IMPLEMENTATION_SUMMARY.md  # Development summary
└── README.md             # This file

πŸ”§ Dependencies

The project uses the following Python packages:

  • Flask 3.1.2 - Web framework
  • gunicorn 21.2.0 - Production WSGI server
  • requests 2.32.5 - HTTP library for testing
  • pytest 9.0.1 - Testing framework
  • pytest-cov 7.0.0 - Code coverage plugin for pytest
  • pytest-flask 1.3.0 - Flask-specific pytest utilities

🌟 Key Features

Timer Functionality

  • Accurate countdown timer with pause/resume
  • Automatic transitions between work and break sessions
  • Visual progress tracking through 4-session cycles
  • Skip to next session option

User Experience

  • Modern, clean interface
  • Responsive design for mobile and desktop
  • Customizable session durations
  • Persistent settings using localStorage
  • Browser notifications

Data Management

  • Automatic session logging to file
  • Timestamped entries for all events
  • Session history API endpoint
  • Completion vs. skip tracking

🚒 Deployment

The application is deployed on Azure App Service using:

  • WSGI server: Gunicorn
  • Configuration: See wsgi.py and startup.txt
  • Environment: Production-ready Flask configuration

Testing the Deployed API

# Check session history
curl http://pomodoro-timer-ecomindo-1763110994.azurewebsites.net/history

πŸ› οΈ Development

Running Unit Tests

The project includes comprehensive unit tests for all Flask routes and functionality. Tests are located in pomodoro_app/test_pomodoro.py with 19 test cases achieving 93% code coverage.

Run all tests:

cd pomodoro_app
uv run pytest test_pomodoro.py -v

Run tests with coverage report (terminal):

cd pomodoro_app
uv run pytest test_pomodoro.py --cov=app --cov-report=term-missing

Run tests with HTML coverage report:

cd pomodoro_app
uv run pytest test_pomodoro.py --cov=app --cov-report=html

This generates an HTML coverage report in htmlcov/index.html that you can open in your browser to see detailed line-by-line coverage.

Run specific test classes:

# Test only the index route
uv run pytest test_pomodoro.py::TestIndexRoute -v

# Test only logging functionality
uv run pytest test_pomodoro.py::TestLogSessionRoute -v

# Test only history functionality
uv run pytest test_pomodoro.py::TestHistoryRoute -v

# Test error handling
uv run pytest test_pomodoro.py::TestErrorHandling -v

Run tests with extra verbose output:

uv run pytest test_pomodoro.py -vv

Test Results

All 19 tests pass with 93% code coverage:

================================================= 19 passed in 0.26s ==================================================
Name     Stmts   Miss  Cover   Missing
--------------------------------------
app.py      41      3    93%   66-68
--------------------------------------

What's Being Tested

The unit tests cover:

  • βœ… Index Route - Homepage rendering and status codes
  • βœ… Session Logging - All session types (work, short break, long break)
  • βœ… Multiple Session Types - Completed vs. skipped sessions
  • βœ… Default Values - Handling of missing optional parameters
  • βœ… History Retrieval - Empty logs, populated logs, malformed entries
  • βœ… Log File Format - Entry structure and append behavior
  • βœ… Error Handling - Invalid JSON, file permissions, exceptions
  • βœ… Data Integrity - Correct parsing and structure of log entries

Running in Debug Mode

The app runs in debug mode by default during local development:

python app.py

🀝 Contributing

This project was built as part of a GitHub Copilot workshop. Feel free to:

  • Fork the repository
  • Create feature branches
  • Submit pull requests
  • Open issues for bugs or enhancements

πŸ“– Learning Resources

This project demonstrates:

  • Flask web development with modern Python
  • Frontend-backend integration using AJAX
  • Session management and logging
  • Responsive web design with CSS
  • Production deployment to Azure
  • Test-driven development practices

πŸ“„ License

This project is open source and available for educational purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 54.5%
  • JavaScript 27.8%
  • CSS 10.0%
  • HTML 7.7%