⏱️ tictac
tictac - a simple timer for your code
(─‿‿─)
__ _ __
/ /_(_)____/ /_____ ______
/ __/ / ___/ __/ __ `/ ___/
/ /_/ / /__/ /_/ /_/ / /__
\__/_/\___/\__/\__,_/\___/
installation
pip install tictac
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.0.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.0.tar.gz.
File metadata
- Download URL: tictac_timer-0.1.0.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 |
aa784ddf3dc4396275145e244e41d5c58c78d6a80add11d0eea3f74ac04f0d72
|
|
| MD5 |
00e370c357d2e6023402ffbb6b0c08c0
|
|
| BLAKE2b-256 |
7e5c54d5805864570ed69859c9810146d77a277dfd6cd038ed0fbcf7acb1fbaa
|
File details
Details for the file tictac_timer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tictac_timer-0.1.0-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 |
05a734894fdfc59f7cc09f3cf2cd16e030a85c2bceb3042a296a680e3b7b1c24
|
|
| MD5 |
0d2592a76ef1e18cc7dcdb422c70d8a4
|
|
| BLAKE2b-256 |
2a4c465aa98607b9e241b5141d954a8ba3fa8da3dfc35a3331b8d5cdf56fedab
|