A thread-safe, persistent, dual-mode CLI alarm system (Alarmy)
Project description
⏰ Alarmy CLI - Dual-Mode Command-Line Alarm System
A professional, robust, and zero-dependency CLI alarm system (Alarmy) written in Python. It runs natively and works seamlessly on Windows, Linux, and macOS.
Designed with Clean Architecture and Unix-style CLI daemon patterns, the application supports:
- Interactive Shell Mode: A fully interactive console screen with a live ticking clock header and dynamic command prompt.
- Daemon Mode: Run the background sound and time monitor (
alarmy daemon). - OS-Native Task Mode (Zero Manual Daemon): Alarms automatically register with the operating system scheduler (Windows Task Scheduler via
schtasksor Linux viacrontab). When the time is reached, the OS automatically pops up a terminal instance to play sound and accept user inputs.
✨ Features
- Global PyPI Package: Install globally as
alarmy-cliand run using thealarmycommand. - Text-to-Speech (TTS) Briefings: Plays a non-blocking voice synthesis briefing (greeting, current local time, alarm label, and random motivational quote) using native OS engines at the start of ringing.
- Customizable Tones:
default: standard 1000Hz beep pattern.digital: rapid dual-beep pattern at 1500Hz.chime: rising musical chimes (C-E-G-C).- Local Audio File: Pass any local path to a
.wavfile to play it in a loop.
- OS-Native Task Automation:
- Windows: Creates user-level tasks using
schtaskswith automatic date fallback mechanisms for locale compatibility (dd/mm/yyyyvsmm/dd/yyyy). - Linux: Appends entries programmatically to the user's
crontab.
- Windows: Creates user-level tasks using
- Atomic File Writing: Prevents state corruption by writing changes to a temporary file before atomically swapping it with the target database file (
~/.cli_alarms.json). - Thread-Safe Memory Lock: Synchronizes all database reads and writes under a shared mutex lock to isolate background checks from user adjustments.
- Automatic Encoding Fallback: Prevents crashes on legacy Windows cmd consoles that default to non-Unicode codepages (e.g., CP1252) by automatically replacing emojis with safe fallback indicators.
- CI/CD Integrated: Automated 15-job matrix testing across OS platforms and Python versions, with secure OIDC publishing to PyPI.
🛠️ Architecture & Design Decisions
┌───────────────────────┐
│ Local CLI Shell │
│ (Direct Single-Cmds) │
└───────────┬───────────┘
│ Writes/Reads
▼
┌───────────────────────┐
│ ~/.cli_alarms.json │◄─── (Atomic State DB)
└───────────────────────┘
▲
│ Reads/Updates State
▼
┌───────────────────────────────────────────────────────────┐
│ Background Daemon Mode │
│ │
│ ┌───────────────────────┐ ┌─────────────────────┐ │
│ │ Scheduler Thread ├──────►│ Sound Loop Thread │ │
│ │ (Monitors System Time)│ │ (Non-blocking Beep) │ │
│ └───────────────────────┘ └─────────────────────┘ │
└───────────────────────────────────────────────────────────┘
▲
│ Triggers Subprocess Ring Command
▼
┌───────────────────────────────────────────────────────────┐
│ OS-Scheduled Task Mode │
│ │
│ ┌────────────────────────┐ ┌────────────────────┐ │
│ │ Windows Task Scheduler ├──────►│ alarmy ring │ │
│ │ / Linux Cron │ │ (Terminal Pop-Up) │ │
│ └────────────────────────┘ └────────────────────┘ │
└───────────────────────────────────────────────────────────┘
🚀 Getting Started
1. Installation
Install from PyPI (Recommended):
pip install alarmy-cli
Install from Local Source (for Development):
To register the alarmy terminal command locally, install the package from the root directory.
- On Windows:
pip install --user -e . - On Linux/macOS:
pip install -e .
Note: Make sure your user script folder is in your system's PATH. If it's not, you can run the executable directly by targeting its path, or use python -m alarm_clock.cli.
2. Running Unit Tests
A comprehensive test suite is included in /tests covering the parser, models, scheduler, serialization, persistence, and OS scheduler triggers. Run it with:
python -m unittest discover -s tests
🕹️ Command Reference
Option A: OS-Native Mode (Recommended - Zero Manual Daemon)
When you add an alarm, it is registered automatically with the operating system.
-
Add an alarm:
alarmy add 07:30 "Wake Up" --snooze-minutes 8 --auto-dismiss 30 --tts --tone chime --math
Flags:
--snooze-minutes: default snooze duration in minutes.--auto-dismiss: auto-dismiss duration in seconds.--tts: enable the native Text-to-Speech briefing.--tone: select a preset tone (default,digital,chime) or specify a path to a local.wavfile.--math: enable the Math Challenge (forces you to solve a simple addition or multiplication problem to dismiss the alarm).
-
List alarms:
alarmy list -
When the time is reached, the operating system launches a terminal window automatically, starts speaking the TTS briefing, triggers the tone audio player, and prompts you:
Press Enter to dismiss, or type 'snooze' to snooze:If you type
snooze, it automatically snoozes for 8 minutes (respecting the custom snooze parameter). -
Remove an alarm (cleans it up from both disk and OS task registries):
alarmy remove 1
Option B: Daemon Mode (Manual Persistent Process)
- Start the monitor daemon (run this in a separate terminal window or pane to play sound when alarms go off):
alarmy daemon - Snooze/Dismiss from your main terminal:
alarmy snooze 1 10 alarmy dismiss 1
Option C: Interactive Shell Mode
If you run alarmy without any arguments, it launches a persistent, interactive console session. It manages its own background timing thread and audio loops automatically in a single terminal.
alarmy
Inside the interactive session, the prompt updates live and you can type sub-commands like add, list, snooze, dismiss, and exit directly:
(12:10:30) alarmy > add 07:30 Morning Workout --tts --tone digital
Success: Created Alarm 1 for 07:30 ('Morning Workout') - one-time, auto-dismiss: 60s, snooze: 5m, TTS Enabled, Tone: digital.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alarmy_cli-1.0.6.tar.gz.
File metadata
- Download URL: alarmy_cli-1.0.6.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d94eebf2665081b61a16e6f2016b7c8a8665b8ca39b41d69bd087a2d93ebe4eb
|
|
| MD5 |
2fb9194b5cff8f7864e1bfcaacfd23e2
|
|
| BLAKE2b-256 |
14399fe1c6c78f6b6572a7e9f697cb63178a74483cb729626b6d2909cda9ffe9
|
Provenance
The following attestation bundles were made for alarmy_cli-1.0.6.tar.gz:
Publisher:
publish.yml on Ramanshu-1216/alarmy-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alarmy_cli-1.0.6.tar.gz -
Subject digest:
d94eebf2665081b61a16e6f2016b7c8a8665b8ca39b41d69bd087a2d93ebe4eb - Sigstore transparency entry: 1880170554
- Sigstore integration time:
-
Permalink:
Ramanshu-1216/alarmy-cli@5528ece2253ea2735a0314de198d09a160c44be8 -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/Ramanshu-1216
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5528ece2253ea2735a0314de198d09a160c44be8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alarmy_cli-1.0.6-py3-none-any.whl.
File metadata
- Download URL: alarmy_cli-1.0.6-py3-none-any.whl
- Upload date:
- Size: 26.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55096c8b71b4b6dc9728d077b36a5d8fca1a94e2c26d081bbd9975824b92487f
|
|
| MD5 |
3d673ca235d1f3c0bfc9342a3c8a913c
|
|
| BLAKE2b-256 |
42d8e8ab440bc6d8d32c87c1e94091bb30bc264a04d1e11b415790c1d3e91682
|
Provenance
The following attestation bundles were made for alarmy_cli-1.0.6-py3-none-any.whl:
Publisher:
publish.yml on Ramanshu-1216/alarmy-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alarmy_cli-1.0.6-py3-none-any.whl -
Subject digest:
55096c8b71b4b6dc9728d077b36a5d8fca1a94e2c26d081bbd9975824b92487f - Sigstore transparency entry: 1880170670
- Sigstore integration time:
-
Permalink:
Ramanshu-1216/alarmy-cli@5528ece2253ea2735a0314de198d09a160c44be8 -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/Ramanshu-1216
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5528ece2253ea2735a0314de198d09a160c44be8 -
Trigger Event:
push
-
Statement type: