executiontime-0.3.1
توضیحات
Utilities to show execution time during development of a module
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | executiontime-0.3.1 |
| نام | executiontime |
| نسخه کتابخانه | 0.3.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Timokasse |
| ایمیل نویسنده | Timokasse@users.noreply.github.com |
| آدرس صفحه اصلی | https://github.com/Timokasse/executiontime |
| آدرس اینترنتی | https://pypi.org/project/executiontime/ |
| مجوز | MIT |
# executiontime
[](https://github.com/Timokasse/executiontim/blob/master/LICENSE)
This module provides a simple function decorator to display its execution time on the console or in the logs.
## Installation
Simply install the package with `pip`:
```bash
pip install executiontime
```
## Usage
You simply need to decorate the function and specify a message template.
```python
from executiontime import printexecutiontime
@printexecutiontime("My function's execution took {0}")
def my_function():
pass
if __name__ == '__main__':
my_function()
```
By default, the message will be displayed on the console. But it is also possible to specify a log function, for example.
```python
from logging import info, INFO, basicConfig
from executiontime import printexecutiontime
@printexecutiontime("My function's execution took {0}", display=info)
def my_function():
pass
if __name__ == '__main__':
basicConfig(level=INFO)
my_function()
```
It is also easy to add a little bit of color:
```python
from executiontime import printexecutiontime, LIGHTBLUE
@printexecutiontime("My function's execution took {0}", color=LIGHTBLUE)
def my_function():
pass
if __name__ == '__main__':
my_function()
```
نیازمندی
| مقدار | نام |
|---|---|
| - | colorama |
نحوه نصب
نصب پکیج whl executiontime-0.3.1:
pip install executiontime-0.3.1.whl
نصب پکیج tar.gz executiontime-0.3.1:
pip install executiontime-0.3.1.tar.gz