Skip to main content

Simple light-weight Python library with handy for every day use decorators

Project description

Decorify

PyPI - Downloads PyPI Latest Release CI - Test GitHub Pages Documentation

Python Library for decorators

Decorify is a lightweight Python library without any dependencies that offers a collection of simple, reusable decorators to enhance your functions. These decorators cover common use cases like logging, timing, retrying, and more.

Installation

Install Decorators via pip:

pip install decorify 

Table of Content

Decorator Main functionality
timeit Measures the time of the function
timeout Terminates the function after it runs for too long
mute Disables stdout for duration of decorated function
validate_typehints Ensures that typehints are followed, raising error if not
retry If exception is raised function is retried up to predefined amount of times
rate_limiter Limits number of function calls such that there are no function calls within set amount of seconds
interval_rate_limiter Splits time into intervals, and limits the number of function calls within each interval
default_value Set default value for function if exception is raised
grid_search Allow user to perform grid search on each iteration of function call
redirect Enables user to redirect function stdout / stderr
crawler Looks for function calls structure and displays it as a tree or nested lists

Additional Modules

Iterative

  • loop: On each call, function is performed n times and all outputs are returned in a list
  • average: Function return mean value of n runs

Plotting (matplotlib)

  • plot_multiple: Creates a plot of a function's return values
  • plot_single: Creates a plot of a function's return

Contributing

Contributions are welcome! Please submit a pull request or open an issue to add new decorators or suggest improvements.

License

This project is licensed under the Apache v2.0 License.

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

decorify-0.1.2.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

decorify-0.1.2-py2.py3-none-any.whl (15.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file decorify-0.1.2.tar.gz.

File metadata

  • Download URL: decorify-0.1.2.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for decorify-0.1.2.tar.gz
Algorithm Hash digest
SHA256 60a4b58779e8a333d84bee1bc240162314e80860b2493b13cbe342c642e92313
MD5 e3d811a721518fd9354ff136b98bdf53
BLAKE2b-256 d0fdc95af076d1445b31a9e9d857f991c00ad249b5f5622a635c217f06525076

See more details on using hashes here.

File details

Details for the file decorify-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: decorify-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for decorify-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e114b899cf93d5b56df9cfb889613d31f10fb2ec0ec93b68431037041cfefdaa
MD5 17abd0d861f014598c9ff1ab1ba67b9e
BLAKE2b-256 eefdb522a779ec4a47c4507a61dd1cf281a2597ee658b7abb118c683dd947c11

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