stopwatch.py
A simple stopwatch for python
What it is and what it does
Stopwatch.py wraps Python's time.perf_counter() in a simple object-oriented interface for measuring elapsed time. It provides a Stopwatch class that can be instantiated, started, stopped, reset, and queried for the elapsed duration in seconds or as a formatted string. The package has no external dependencies and runs entirely in-process—there is no background task or thread; timing is purely mathematical arithmetic on the counter values.
The package is designed for straightforward use cases where you need to measure how long a code block or operation takes. You can control decimal precision when converting to a string representation, and the stopwatch can be paused and resumed. It is lightweight enough for quick instrumentation but offers no advanced features like lap timing, multiple concurrent timers, or statistical aggregation.
Use it for:
- Measure execution time of a function or code block during development or debugging.
- Track elapsed time in a game loop or animation to control frame timing.
- Benchmark performance of different algorithms or implementations.
- Monitor how long a background task or operation takes in a simple script.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a simple stopwatch timer that measures elapsed time using Python's high-resolution performance counter, with methods to start, stop, reset, and retrieve the duration.
Yes, if you need a minimal, dependency-free timer. The package is straightforward and well-suited for quick timing tasks. However, note that maintenance is dormant—no updates since 2022-09-04—so expect no bug fixes or Python version support beyond what is already declared. For production code or long-term projects, consider whether a more actively maintained alternative or Python's built-in timeit module better fits your needs.
Install
stopwatch-py on PyPI
pip
pip install stopwatch-pyuv
uv add stopwatch-pypoetry
poetry add stopwatch-pyInstalling stopwatch.py
Before you install
Low install friction with no runtime dependencies. Dormant maintenance status since the latest release on 2022-09-04, though the repository remains active and unarchived.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open and closed-source projects.
Quickstart
pip install stopwatch.py
from stopwatch import Stopwatch
stopwatch = Stopwatch(2)
stopwatch.stop()
print(stopwatch.duration)
Requires Python 3.5 or later.
Verify before relying
- Whether the package handles edge cases like repeated start/stop cycles or very long durations correctly.
- Performance characteristics when timing very short intervals (microsecond-level precision).
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,440 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 190,144/month — #9,914 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: stopwatch.py-2.0.1-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
about-timeMeasures execution time and throughput of code…
permissive · top 5,000 on PyPI
codetimingMeasures elapsed time in Python code using a…
permissive · top 5,000 on PyPI
monotonicProvides a monotonic clock function that…
permissive · top 5,000 on PyPI
win-precise-timeProvides high-resolution time measurement and…
permissive · top 15,000 on PyPI
throttlerProvides rate limiting, concurrency limiting,…
permissive · top 5,000 on PyPI
pytest-timerPytest plugin that measures and reports the…
permissive · top 15,000 on PyPI
businesstimedeltaCalculates elapsed working time between two…
permissive · top 5,000 on PyPI
deltaParses human-readable duration strings like '1…
permissive · top 15,000 on PyPI
statsdA Python client library that sends metrics to a…
permissive · top 5,000 on PyPI
line-profilerline_profiler measures execution time on a…
permissive · top 5,000 on PyPI