Utilities to show execution time during development of a module
Project description
executiontime
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
:
pip install executiontime
Usage
You simply need to decorate the function and specify a message template.
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.
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()
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
executiontime-0.2.1.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for executiontime-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d48c4a8e51ef8d5434140f122da444e00f099cffe7f4c131e26825fe0ac4351 |
|
MD5 | 590a9bf7ee509646ed00d6878cd80e3e |
|
BLAKE2b-256 | b9fc09c9447c1c50c82539f8d0d07ab68b96419da1412d9810af298c14626953 |