Penguin: a customizable stopwatch decorator
Project description
🐧 Penguin_py 🐧
Penguin is a lightweight, customizable stopwatch ⏱ decorator that helps you determine how long it takes for your functions to run.
Meet Peter, penguin_py's
beloved mascot!
Source code
The source code of this package lives here: https://github.com/espitiaandres/penguin
Installation
With Command Line
To install penguin_py
with the command line, run this command:
pip install penguin_py
.
With a requirements.txt
file
To install penguin_py
using a requirements.txt
file, add this line to your requirements.txt
file.
penguin-py==0.1.1
Usage
✅ To run with default kwargs:
from penguin_py import penguin
@penguin()
def test_func(test1, test2=None):
# NOTE: this function can be anything!
for i in range(10000000):
pass
return "test", True
test = test_func("", test2=":")
This will output the following to your logger:
✅ To run with user specified kwargs:
@penguin(
verbose=True,
show_args=True,
show_return=True,
)
def test_func(test1, test2=None):
# NOTE: this function can be anything!
for i in range(10000000):
pass
return "test", True
test = test_func("", test2=":")
This will output the following to your logger:
❌ Since penguin
is a decorator that takes in kwargs, do not call it without the brackets ()
.
@penguin
def test_func(test1, test2=None):
# NOTE: this function can be anything!
for i in range(10000000):
pass
return "test", True
test = test_func("", test2=":")
You'll get a TypeError
relating to arguments.
List of kwargs
Note: by default, all kwargs are set to False
.
verbose
: WhenTrue
, it shows all logs that are described by the other kwargs. WhenFalse
, each kwarg would determine if that specific log is shown.show_args
: WhenTrue
, it shows the function's signature, with the*args
and**kwargs
being passed in.show_return
: WhenTrue
, it shows the function's return value(s).
Documentation
Documentation of penguin_py
can be found here: https://github.com/espitiaandres/penguin/blob/master/README.md
Bugs/Requests
If you find any bugs or have any suggestions to penguin_py
, submit them in the issues tab in the Github repo. This can be found here: https://github.com/espitiaandres/penguin/issues
License
Distributed under the terms of the MIT license, penguin_py
is free and open source software.
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
Hashes for penguin_py-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6b434dd60a62d35f28a5326818f4743667f35ff12839d91d559a50035d77a56 |
|
MD5 | a95476990f6b00a09268652772c4a3d5 |
|
BLAKE2b-256 | d4fb821cee25cdc67dfcf0447ab40d3e21e991bcea357a8c5d961e136eb13235 |