A simple command-line Pomodoro Timer written in Python for improving productivity using the Pomodoro Technique. It alternates between work and break sessions, helps reduce burnout, and includes a terminal beep as a reminder.
The Pomodoro Technique is a time management method developed by Francesco Cirillo. It uses a timer to break work into intervals, traditionally:
\a) when a session endspython pomodoro.py
import timeUsed for:
time.sleep(seconds): Pauses the program for the given number of seconds to create a countdown effect.def format_time(seconds)Purpose: Converts total seconds to a readable format like mm:ss.
def format_time(seconds):
mins = seconds // 60
secs = seconds % 60
return f"{mins:02d}:{secs:02d}"
Example: format_time(150) returns 02:30
work_duration = 25 * 60
break_duration = 5 * 60
cycles = 4
You can change these values for quick testing (e.g. work_duration = 5 for 5 seconds).
for cycle in range(1, cycles + 1):
Runs the work + break cycle 4 times.
for remaining in range(work_duration, 0, -1):
print(f"Work: {format_time(remaining)}", end='\r')
time.sleep(1)
Same as work timer but uses break_duration.
print("\a")
This plays the bell sound in the terminal.
Pomodoro Cycle 1 - Work Time!
Work: 24:59
Work: 24:58
...
Time to take a break! ๐
Break: 04:59
Break: 04:58
...
Break over! Get ready to work again.
| Feature | Description |
|---|---|
| Timer Format | Countdown in mm:ss format |
| Terminal Refresh | Clean, single-line updates |
| Sound Alert | Terminal bell \a at session end |
| Cycles | 4 repeated Pomodoro sessions |
| Beginner-Friendly | No external libraries, pure Python |
| What you want to change | How to do it |
|---|---|
| Shorter testing times | Change work_duration and break_duration to smaller numbers |
| More Pomodoros | Change the value of cycles |
| Add long breaks | Add a longer break after 4 cycles |
| Add GUI or sound files | Use libraries like tkinter or playsound |
playsound for custom audio alertsThis project is open-source and free to use for personal productivity!