PYTHON PROJECT / 03

Pomodoro
timer.

A terminal-based focus timer that guides work sessions and breaks, using notifications to make each completed block feel intentional.

25
LANGUAGEPython
MODULEStime · plyer
USE CASEFocus sessions

THE WORKFLOW

Focus, rest, repeat.

01

Start a focused work session with a visible countdown.

02

Show a desktop notification when it is time to take a break.

03

Repeat for a configurable number of productive sessions.

SOURCE SNAPSHOT

Core code.

import time
from plyer import notification

pomodoro_duration = 45 * 60
break_duration = 15 * 60

def countdown(seconds, message):
    while seconds:
        minutes, seconds_left = divmod(seconds, 60)
        print(f"{message}: {minutes:02d}:{seconds_left:02d}", end="\r")
        time.sleep(1)
        seconds -= 1

countdown(pomodoro_duration, "Focus")
notification.notify(title="Pomodoro", message="Time's up! Take a break.")