feat: add Pomodoro Timer CLI productivity tool in Python#556
Closed
MD-Mushfiqur123 wants to merge 1 commit into
Closed
feat: add Pomodoro Timer CLI productivity tool in Python#556MD-Mushfiqur123 wants to merge 1 commit into
MD-Mushfiqur123 wants to merge 1 commit into
Conversation
This commit introduces a complete Pomodoro Timer application implemented
in Python, designed to help users practice the Pomodoro Technique for
effective time management and productivity enhancement.
The Pomodoro Technique is a widely adopted time management methodology
developed by Francesco Cirillo in the late 1980s. The technique uses a
timer to break work into focused intervals (traditionally 25 minutes),
separated by short breaks. After every four work intervals, a longer
break is taken to allow for mental recovery and sustained concentration.
Project Overview:
The pomodoro-timer project is a command-line interface application that
guides users through the complete Pomodoro Technique workflow. It features
a real-time countdown display, automatic session tracking, configurable
durations for work and break periods, and a clean terminal-based user
interface that updates in place without cluttering the screen.
Key Features Implemented:
1. Configurable Timer Durations - Users can customize the length of work
sessions, short breaks, and long breaks via command-line arguments.
Default values follow the traditional Pomodoro Technique: 25 minutes
for work, 5 minutes for short breaks, and 15 minutes for long breaks.
2. Automatic Session Cycling - The application automatically tracks the
number of completed work sessions and inserts a long break after every
fourth session, as prescribed by the original technique.
3. Real-Time Countdown Display - The timer updates in place on the same
terminal line using carriage return characters, providing a clean and
unobtrusive countdown that does not flood the terminal output.
4. Graceful Exit Handling - When the user interrupts the timer with
Ctrl+C, the application catches the KeyboardInterrupt exception and
displays a summary of how many sessions were completed before exiting.
5. Zero External Dependencies - The application uses only Python standard
library modules (argparse, sys, time), making it immediately runnable
on any system with Python 3.6 or higher installed.
Technical Implementation:
The code is structured into four main functions, each with a single
responsibility and comprehensive docstrings following PEP 257 conventions:
- parse_arguments(): Handles CLI argument parsing using argparse with
sensible defaults and helpful usage descriptions.
- display_timer(): Renders the countdown display on a single terminal
line using carriage return for in-place updates.
- countdown(): Manages the countdown loop, calling display_timer for
each second and sleeping between updates.
- run_pomodoro(): Orchestrates the full Pomodoro cycle, alternating
between work sessions and breaks, tracking session counts, and
handling user interruption gracefully.
The main entry point parses arguments and launches the pomodoro loop.
Type hints are provided for all function parameters and return values,
enabling static analysis tools like mypy to verify type correctness.
Usage Examples:
Default configuration:
python pomodoro_timer.py
Custom durations:
python pomodoro_timer.py --work 30 --short-break 10 --long-break 20
This contribution adds value to the 100LinesOfCode repository by
providing a practical, real-world utility that demonstrates clean Python
code organization, command-line interface design, and effective use of
the standard library. The project is well under the 100-line limit while
delivering meaningful functionality.
Collaborator
|
Thanks for your contribution! However, this submission exceeds the 100-line limit (pomodoro_timer.py is 109 lines). The repo requires each program file to be under 100 lines of code. Additionally, there's already a similar Pomodoro Timer PR (#555) submitted earlier that meets the line count requirement. Feel free to check out other ideas from our issues or contribute something else! We appreciate your interest in the project. 🎯 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pomodoro Timer - CLI Productivity Tool
A complete Pomodoro Timer application implemented in Python that helps users practice effective time management.
What This Adds
A new
pomodoro-timer/directory containing:pomodoro_timer.py- The main application (under 100 lines)README.md- Documentation with usage instructionsFeatures
Usage
Why This Project
The Pomodoro Technique is one of the most popular time management methods. This implementation provides a practical, lightweight CLI tool that demonstrates clean Python code organization, argparse usage, and effective standard library utilization - all within the 100-line constraint.