Skip to main content

Tiny timing helper for printing elapsed times with call-site context

Project description

gadget

Tests

A tiny helper for quick timing/debug prints with file and line context.

Install

From a local checkout

pip install .

Directly from GitHub

pip install "git+https://github.com/s-maddrellmander/gadget.git"

Editable install (for development)

pip install -e .

Usage

Functional API

from gadget import gadget, gadget_reset, gadget_config

gadget("start")
# ... some code ...
gadget("after step")

gadget("phase 1", group="build")
gadget("phase 2", group="build")
gadget_reset("build")

gadget_config(verbose=False)  # disable output globally

Class-based API

from gadget import Gadget

timer = Gadget(verbose=True)
timer("start")
# ... some code ...
timer("step", group="build")
timer.reset("build")
timer.reset()  # reset all groups

Install from PyPI

pip install gadget-timer

Notes

  • Package name on PyPI is gadget-timer.

  • Import path is still gadget.

  • For Git installs, the repository URL is:

    pip install "git+https://github.com/s-maddrellmander/gadget.git"
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gadget_timer-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gadget_timer-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file gadget_timer-0.1.0.tar.gz.

File metadata

  • Download URL: gadget_timer-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gadget_timer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a8d3234886c89e2c242b12bf7f5e6bb180fbda0057fac7f5943bec17f4869eb2
MD5 d1cbd78e2a55931097026ff3a33fd5d4
BLAKE2b-256 b5a4396308aaf1d2617f1279c0b8fe0691bd69b26dbafbd01cf1eeffc5b1a8b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for gadget_timer-0.1.0.tar.gz:

Publisher: publish-pypi.yml on s-maddrellmander/gadget

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gadget_timer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gadget_timer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gadget_timer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 471caa6cadedcd2a5364f1abc0c2d985af2afea41d8ca1d597183cb8c35065c7
MD5 a64b83444a20084bea2882bd14ab3a3d
BLAKE2b-256 266a2889453dc0f85f70d308bc79aba9b30973587518055c9ba66d0496e7f397

See more details on using hashes here.

Provenance

The following attestation bundles were made for gadget_timer-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on s-maddrellmander/gadget

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page