⏱️ tictac
tictac - a simple timer for your code
(─‿‿─)
__ _ __
/ /_(_)____/ /_____ ______
/ __/ / ___/ __/ __ `/ ___/
/ /_/ / /__/ /_/ /_/ / /__
\__/_/\___/\__/\__,_/\___/
installation
pip install tictac-timer
quick start
from tictac import timer
import time
# context manager
with timer("data loading"):
time.sleep(1.2)
# [tictac] data loading: 1.20 sec
# decorator
@timer
def heavy_process():
time.sleep(0.5)
# [tictac] heavy_process: 0.50 sec
# decorator with parameters
@timer("processing", unit="ms")
def fast_process():
time.sleep(0.01)
# [tictac] processing: 10.00 ms
parameters
timer(name=None, unit="s", output=None)
- name — timer label (defaults to function name)
- unit — time unit:
"s","ms","min" - output — callback
(msg: str) -> None(defaults toprint)
examples
custom output
import logging
log = logging.getLogger(__name__)
with timer("query", output=log.info):
db.execute("SELECT ...")
multiple timers
with timer("preparation"):
time.sleep(0.3)
with timer("processing", unit="ms"):
time.sleep(15)
# [tictac] preparation: 0.30 sec
# [tictac] processing: 15.00 ms
license
Metadata
Release files for tictac-timer 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tictac_timer-0.1.1.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tictac_timer-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.5 kB
Release files / tictac_timer-0.1.1.tar.gz
| Download URL | tictac_timer-0.1.1.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94ae0d1fe9ba053148db993e11dfeae3d5bd5655bf14d7c3e6e2bf4409ee8e32
|
|
BLAKE2b-256 checksum How to use checksums |
e90dc5b0ca5a73c9aee09e0cb2830ebe1ff3d982cd74d4ac40c3e57a969a1594
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / tictac_timer-0.1.1-py3-none-any.whl
| Download URL | tictac_timer-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1aadf9b9312b041dea168fe507a38b680b1b52e8d67b3796c83023434981f39
|
|
BLAKE2b-256 checksum How to use checksums |
6315cd406d70d35b6f03e6359d9fa02ca0a28712640d49bad7d47094d3555721
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|