func-hooks-1.2.0
توضیحات
-
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | func-hooks-1.2.0 |
| نام | func-hooks |
| نسخه کتابخانه | 1.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Francisco Del Roio |
| ایمیل نویسنده | francipvb@hotmail.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/func-hooks/ |
| مجوز | - |
# Func hooks
Hooks for python functions.
## Motivation:
I am developing a system with a microservices architecture and I want to add event hooks to some methods.
However, I don't want to add unrelated code to the busines logic methods. Because this, I developed this package, to be able to add execution points to a particular function.
## Example usage:
```python
>>> import func_hooks
>>> @func_hooks.hooks
... def my_func():
... print("Ran my_func")
...
>>> @my_func.on_before
... def _run_before(invocation):
... print("Running before my_func.")
...
>>> @my_func.on_after
... def _run_before(invocation_result):
... print("Running after my_func.")
...
>>> my_func()
Running before my_func.
Ran my_func
Running after my_func.
>>>
```
نیازمندی
| مقدار | نام |
|---|---|
| >=4.4.0,<5.0.0 | typing-extensions |
| >=3.6.2,<4.0.0 | anyio |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<4.0 | Python |
نحوه نصب
نصب پکیج whl func-hooks-1.2.0:
pip install func-hooks-1.2.0.whl
نصب پکیج tar.gz func-hooks-1.2.0:
pip install func-hooks-1.2.0.tar.gz