Skip to main content

stoppy ⏱

A precise and lightweight stopwatch built on top of perf_counter, which can be used as a replacement for perf_counter that returns absolute time starting from zero.

The stopwatch can optionally be started automatically by calling time(True) instead of start(), which can streamline usage when polling the time repeatedly.

Installation

Install from PyPI via:

pip install stoppy

Usage

Basic usage is as follows:

from time import sleep
from stoppy import Stopwatch

with Stopwatch(start=True) as stopwatch:
    sleep(0.1)
    stopwatch.stop()
    print(stopwatch.time())
    stopwatch.reset()

It can also be used as a direct replacement for perf_counter that returns absolute time starting from zero:

from stoppy import Stopwatch

with Stopwatch() as stopwatch:
    # Calling `stopwatch.time(True)` is equivalent to calling `perf_counter()`, but starts from exactly zero
    print(stopwatch.time(True))

For all usage examples see examples/.

Metadata

Release files for stoppy 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stoppy 1.0.5
File Size Uploaded
stoppy-1.0.5.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stoppy 1.0.5
File Interpreter ABI Platform
stoppy-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / stoppy-1.0.5.tar.gz

Download URL stoppy-1.0.5.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e113e7f7369c969108cc925d3ed5e247196c1a0f633b35ca6887886d40261a19
BLAKE2b-256 checksum
How to use checksums
5d9e57e189186bb267dd7c36e68e5a00874879d3569df32361eea0f0cd1c1456
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.3 Darwin/22.3.0

Release files / stoppy-1.0.5-py3-none-any.whl

Download URL stoppy-1.0.5-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
917b7ddb5c238d095e36570d458cbe1d6655adb1332782d6f90d4c415f3aba28
BLAKE2b-256 checksum
How to use checksums
d181ee00d9a480bee912db48460e78dcff97e534d007d9174862d44d6c341532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.3 Darwin/22.3.0

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

1 release file

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page