The ececy exec_time decorator is a utility that measures the execution time of a function. It can be used to easily track and log the time taken by a function to execute, both for synchronous and asynchronous functions.
Project description
Execy
The execy @exec_time decorator is a utility that measures the execution time of a function. It can be used to easily track and log the time taken by a function to execute, both for synchronous and asynchronous functions.
Table of Contents
Installation
pip install execy
Usage
To use the exec_time decorator, follow these steps:
from execy import exec_time
import asyncio
import time
@exec_time
def sync_function():
# Simulate a time-consuming synchronous task
time.sleep(2)
@exec_time
async def async_function():
# Simulate a time-consuming asynchronous task
await asyncio.sleep(2)
# Call the decorated synchronous function
sync_function()
# Call the decorated asynchronous function
asyncio.run(async_function())
The result will be
Function 'sync_function' executed in 2.0001089572906494 seconds.
Function 'async_function' executed in 2.001432180404663 seconds.
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
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 execy-0.1.9.tar.gz.
File metadata
- Download URL: execy-0.1.9.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c0bc0a9672880b72b17f2dbd4903106684573c910d3fb1605307eb5e78c6cd8
|
|
| MD5 |
18a7d17bf12a879a91311a91600498f1
|
|
| BLAKE2b-256 |
f29f889e66d2400b15415bbff1ea73428fd0b3af97ced73a4dbb1381a0a676e3
|
File details
Details for the file execy-0.1.9-py3-none-any.whl.
File metadata
- Download URL: execy-0.1.9-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17ab9b6d95fcf041f1bb3edd5839055bcdc9237afa3efa66ce155e33f4bc0929
|
|
| MD5 |
46b0cab5ebd1456ff96474fa8ab45a88
|
|
| BLAKE2b-256 |
6dfed1711b9a036582fd799707db045c679af6462bf35121774460c6d12fa5d6
|