A tiny and simple Python timer/stopwatch utility.
Project description
timifypy
A tiny, clean, and useful timing utility for Python.
Measure execution time effortlessly with a context manager or a manual stopwatch.
🚀 Installation
pip install timifypy
## Advanced Usage
### ⏱ Manual Stopwatch
```python
from timifypy import Stopwatch
sw = Stopwatch()
sw.start()
# some heavy computation
sum(range(1000000))
sw.stop()
print(sw) # e.g., <Stopwatch 12.34 ms>
print(sw.elapsed) # raw seconds
##Basic Usage
from timifypy import Stopwatch
sw = Stopwatch()
sw.start()
# some heavy computation
sum(range(1000000))
sw.stop()
print(sw) # e.g., <Stopwatch 12.34 ms>
print(sw.elapsed) # raw seconds
#Context Manager
from timifypy import timer
with timer("example computation"):
sum(range(1000000))
##Context Manager with Logging
from timifypy import timer
with timer("load data", log_file="timings.log"):
sum(range(1000000))
#Multiple Timers
from timifypy import timer
with timer("step 1"):
sum(range(500000))
with timer("step 2"):
sum(range(500000, 1000000))
##Using Stopwatch for Multiple Steps
from timifypy import Stopwatch
sw = Stopwatch()
sw.start()
sum(range(500000))
sw.stop()
print("Step 1:", sw)
sw.start()
sum(range(500000, 1000000))
sw.stop()
print("Step 2:", sw)
print("Total elapsed:", sw.elapsed)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timifypy-0.1.1.tar.gz
(2.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 timifypy-0.1.1.tar.gz.
File metadata
- Download URL: timifypy-0.1.1.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35d0f3ec2f2a8458f736a0b5dddf1fc8f5dc7f2f309063226e5518237fd1dd0b
|
|
| MD5 |
ccc1f24d5f1dc7d18c15740698bd17e6
|
|
| BLAKE2b-256 |
6efaf79db7b88efb55c5a65d2561b0ae24d4a5a3b53be41b456a90440793caf8
|
File details
Details for the file timifypy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: timifypy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
317311ef49424b31cc3d55d889009a8f6a2d2643c6efc8413898579578f62b96
|
|
| MD5 |
d4d19b2977d930006e03ea181f4ff04e
|
|
| BLAKE2b-256 |
dfa168ef40a03e38528e5b5e1484bd1799834dae93cd98bdb2af856040050457
|