Productivity-Timer
Productivity-Timer is a Python library for managing multiple timers, one for each specified individual. It allows starting, stopping, pausing, resuming, resetting, and retrieving elapsed times for timers on a per-person basis. The library also supports optional timeouts, so timers can automatically stop after reaching a specified duration.
Features
- Start, stop, pause, resume, and reset individual timers.
- Track multiple timers for different individuals.
- Optional timeout support for automatic stopping.
- Retrieve formatted elapsed times for each person.
- Stop and reset all timers with a single command.
Installation
To install Productivity-Timer, use pip:
pip install productivity-timer
Usage
Importing the Library
from productivity_timer import ProductivityTimer
Quick Start
from productivity_timer import ProductivityTimer
timer = ProductivityTimer()
timer.start("Abhishek", timeout=10)
timer.start("Ram")
timer.pause("Abhishek")
timer.resume("Abhishek")
timer.stop("Ram")
print(f"Elapsed time for Abhishek: {timer.get_elapsed_time('Abhishek', formatted=True)}")
timer.stop_all()
print(timer)
Available Functions
-
start(person, timeout=None)
Starts a timer for the specified person. If a timer for this person already exists, it resumes the timer. Thetimeoutargument sets a maximum duration for the timer (in seconds). -
stop(person)
Stops the timer for the specified person and updates the total elapsed time. -
pause(person)
Pauses the timer for the specified person without resetting the elapsed time. The timer can be resumed later. -
resume(person)
Resumes a paused timer for the specified person. -
reset(person)
Resets the timer for the specified person to zero, clearing any elapsed time. -
get_elapsed_time(person, formatted=False)
Returns the elapsed time for the specified person. Ifformatted=True, the time is returned as a formatted string inHH:MM:SS. -
get_all_elapsed_times(formatted=False)
Returns a dictionary of elapsed times for all tracked persons. Ifformatted=True, times are formatted inHH:MM:SS. -
stop_all()
Stops all active timers. -
reset_all()
Resets all timers, clearing any elapsed times. -
check_timeouts()
Checks each timer against its timeout value (if any). If a timer's elapsed time exceeds its timeout, the timer is automatically stopped.
Examples
Setting Up a Timer with a Timeout
timer.start("Abhishek", timeout=30)
Checking and Stopping All Active Timers
timer.stop_all()
Formatting Elapsed Time
formatted_time = timer.get_elapsed_time("Abhishek", formatted=True)
print(f"Elapsed time for Abhishek: {formatted_time}")
Contributing
Contributions are welcome! If you would like to report issues, suggest new features, or contribute code, please create a pull request or open an issue on the GitHub repository.
Metadata
Release files for productivity-timer 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| productivity_timer-1.0.2.tar.gz | 4.7 kB | Without provenance | Details for productivity_timer-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| productivity_timer-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for productivity_timer-1.0.2-py3-none-any.whl |
Total release size: 10.3 kB
Release files / productivity_timer-1.0.2.tar.gz
| Download URL | productivity_timer-1.0.2.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18ad481890e2e290716588e85669f4cfcdb6956c320e9d60e55a3e4e067e322a
|
|
BLAKE2b-256 checksum How to use checksums |
6ef4eda8e44c06f8d021a6b7076d945ec6b7f8bb9d8a61cf79b470a64280b359
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Release files / productivity_timer-1.0.2-py3-none-any.whl
| Download URL | productivity_timer-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fcc2cfa830486a3ea7d8ca58f10015e9a543ff53734761d695db0bebd40945fb
|
|
BLAKE2b-256 checksum How to use checksums |
aceaf228096f9bb9fc511f4caa5e90bb779e92976e08e2fd826601def5144f9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Security for productivity-timer 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.