A lightweight CLI stopwatch and timer in Python
Project description
PSW - Python Stop Watch
psw is a lightweight, intuitive Command Line Interface (CLI) stopwatch and timer utility written in Python. It features live console rendering, interactive real-time controls, and built-in repeat functionalities without requiring any complex external audio dependencies.
Install
You can install psw via pip:
pip install psw
Usage
1. Stopwatch Mode
Measure elapsed time directly in your terminal.
Start the Stopwatch
To start the stopwatch, run:
psw start
The live clock will be displayed in the console:
00 h 00 m 00.000 s
Options
-p, --precision: Specifies the number of decimal places for seconds.- Default:
3(millisecond precision) - Example:
psw start -p 2will display00 h 00 m 00.00 s
Interactive Controls (While Running)
While the stopwatch is active, you can control it in real-time using the following keys:
s: Pause / Resume the stopwatch.l: Record a lap time. The current lap time will be printed below the running clock without stopping the main timer.q(orCtrl+C): Quit the stopwatch and display the final summary.
2. Timer Mode
Count down from a specified duration with advanced repeat and notification options.
Start the Timer
To start a countdown, use the timer command followed by the duration. You can specify hours (h), minutes (m), and seconds (s).
# Set a timer for 5 minutes and 30 seconds
psw timer 5m 30s
# Set a timer for 1 hour
psw timer 1h
The countdown will be displayed in the console:
00 h 05 m 30.000 s
Options
-p, --precision: Same as the stopwatch mode, specifies the decimal places for seconds (Default:3).-r, --repeat [<integer>]: Restarts the timer when it reaches zero.- Use without arguments for an infinite loop.
- Example:
psw timer 1m -r
- Example:
- Specify an integer to repeat a specific number of times.
- Example:
psw timer 1m -r 3(Runs a 1-minute timer 3 times)
- Example:
- Use without arguments for an infinite loop.
-m, --mute: Disables the system alert sound (terminal bell) when the timer ends.
Interactive Controls (While Running)
s: Pause / Resume the countdown.q(orCtrl+C): Cancel and exit the timer.
[!NOTE] When the timer reaches
00 h 00 m 00.000 s, the application plays a platform-appropriate alert notification (usingwinsound.MessageBeep()on Windows, and emitting a standard terminal bell sound\aon other platforms or as a fallback). No special OS-level audio permissions or external audio library imports are required, making it lightweight and cross-platform compatible.
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 psw-0.1.4.tar.gz.
File metadata
- Download URL: psw-0.1.4.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5999da0cfb75331daecd2c55f4b76f38b16090da14bcb82bdcf451fd25028329
|
|
| MD5 |
c208e60f0862e2dcb3e6db7648ea675a
|
|
| BLAKE2b-256 |
aa1ce667ff0ad55256d1719571343fc3250d0c55292ed83881eaa14ed7b39c6c
|
Provenance
The following attestation bundles were made for psw-0.1.4.tar.gz:
Publisher:
workflow.yml on KenjiOhtsuka/psw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psw-0.1.4.tar.gz -
Subject digest:
5999da0cfb75331daecd2c55f4b76f38b16090da14bcb82bdcf451fd25028329 - Sigstore transparency entry: 2172903765
- Sigstore integration time:
-
Permalink:
KenjiOhtsuka/psw@4a57e75d555e3e1cb59e979c738c07d660c39d0d -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/KenjiOhtsuka
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@4a57e75d555e3e1cb59e979c738c07d660c39d0d -
Trigger Event:
release
-
Statement type:
File details
Details for the file psw-0.1.4-py3-none-any.whl.
File metadata
- Download URL: psw-0.1.4-py3-none-any.whl
- Upload date:
- Size: 10.2 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 |
b2cba7321756fd77560973c65681db8a62898ab7fc037ea03e748bb006c31be5
|
|
| MD5 |
185c5854bd511e47ddac56656d64cde1
|
|
| BLAKE2b-256 |
326fa58b0cb8f5031d060198bfb253a639a4a1edf89b6e8d9fa6129b3f2ec979
|
Provenance
The following attestation bundles were made for psw-0.1.4-py3-none-any.whl:
Publisher:
workflow.yml on KenjiOhtsuka/psw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psw-0.1.4-py3-none-any.whl -
Subject digest:
b2cba7321756fd77560973c65681db8a62898ab7fc037ea03e748bb006c31be5 - Sigstore transparency entry: 2172903788
- Sigstore integration time:
-
Permalink:
KenjiOhtsuka/psw@4a57e75d555e3e1cb59e979c738c07d660c39d0d -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/KenjiOhtsuka
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@4a57e75d555e3e1cb59e979c738c07d660c39d0d -
Trigger Event:
release
-
Statement type: