⏱️ 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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tictac_timer-0.1.1.tar.gz
(14.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tictac_timer-0.1.1.tar.gz.
File metadata
- Download URL: tictac_timer-0.1.1.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94ae0d1fe9ba053148db993e11dfeae3d5bd5655bf14d7c3e6e2bf4409ee8e32
|
|
| MD5 |
afb38230d5078487f2a6591d96d485af
|
|
| BLAKE2b-256 |
e90dc5b0ca5a73c9aee09e0cb2830ebe1ff3d982cd74d4ac40c3e57a969a1594
|
File details
Details for the file tictac_timer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tictac_timer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1aadf9b9312b041dea168fe507a38b680b1b52e8d67b3796c83023434981f39
|
|
| MD5 |
b0ba9640873a5f6979c430edbdcb9f7e
|
|
| BLAKE2b-256 |
6315cd406d70d35b6f03e6359d9fa02ca0a28712640d49bad7d47094d3555721
|