Skip to main content

Penguin: a customizable stopwatch decorator

Project description

🐧 Penguin_py 🐧

Penguin: a customizable stopwatch decorator ⏱

Peter the penguin, penguin_py's mascot.

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:

Sample penguin output

✅ To run with user specified kwargs:

@penguin(
    verbose=False,
    show_args=False,
    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:

Sample penguin output kwargs

❌ Since penguin is a decorator that takes in kwargs, do not call it like this (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: When True, it shows all logs that are described by the other kwargs. When False, each kwarg would determine if that specific log is shown
  • show_args: When True, it shows the function's signature, with the *args and **kwargs being passed in.
  • show_return: When True, 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

penguin_py-0.2.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

penguin_py-0.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file penguin_py-0.2.0.tar.gz.

File metadata

  • Download URL: penguin_py-0.2.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for penguin_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d2244b9368420dfd8c243605a0e3e1e27815c255d919cd4275b423dec9f677ef
MD5 fca12fd06ed3d5b67921f726a6332526
BLAKE2b-256 2ba3bc5e1469b9c66a0ae4107324f5fde32830befa22e4a8c53df40398454112

See more details on using hashes here.

File details

Details for the file penguin_py-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: penguin_py-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for penguin_py-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f8430f4382fba5531ec34bf1fe5950fbcdab27f389497afcaf4f6af49c018f8
MD5 6ba4a37860158a9c7fab8c1e7a967847
BLAKE2b-256 23ef402a3d010b8fd31501f312201d103c51903790edff7dde868b383370449c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page