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.
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.3.2
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=":")
✅ To run with user specified kwargs:
@penguin(
verbose=True,
show_args=True,
show_return=True,
foreground='cyan',
background='yellow',
)
def test_func(test1, test2=None):
for i in range(10000000):
pass
return "test", True
test = test_func("", test2=":")
Note: For a more detailed list of all kwargs and their defaults, visit this section: List of kwargs
❌ Since penguin is a decorator that takes in kwargs, do not call it without the brackets ().
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=":")
You'll get a TypeError relating to arguments.
List of kwargs
verbose: WhenTrue, it shows all logs that are described by the other kwargs. WhenFalse, each kwarg would determine if that specific log is shown- default:
False
- default:
show_args: WhenTrue, it shows the function's signature, with the*argsand**kwargsbeing passed in.- default:
False
- default:
show_return: WhenTrue, it shows the function's return value(s).- default:
False
- default:
foreground: When chosen from this list,["red" "yellow", "green", "blue", "magenta", "cyan", "grey"], it colour the logger output text the chosen colour.- default:
"grey"
- default:
background: When chosen from this list,["red" "yellow", "green", "blue", "magenta", "cyan", "grey", "black", "white"], it colour the logger output background the chosen colour.- default:
"black"
- default:
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
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 penguin_py-0.3.3.tar.gz.
File metadata
- Download URL: penguin_py-0.3.3.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5000f39bfd2e9c64bad0084bc3371f44a6703b7e6ae746e3f7e0ba66d301573e
|
|
| MD5 |
2dfbf3ee3954a759341148450ab51619
|
|
| BLAKE2b-256 |
599b7fa02a2ecc135fcb12cd3f5126e72a0fa9611684bc2658bdadebe8ab479a
|
File details
Details for the file penguin_py-0.3.3-py3-none-any.whl.
File metadata
- Download URL: penguin_py-0.3.3-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3be7d1b645516db5850c33454a262a1b287bfa0c6d2f09461a3565a1bcc75bd0
|
|
| MD5 |
0542f201924725fb43404fe87723e10f
|
|
| BLAKE2b-256 |
1cebfcbfbddf82a3ae6b19cb4534a837928c41cd46ce47a1677a2099a22142e6
|