No project description provided
Project description
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:
>>> 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.
>>>
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
func_hooks-1.1.0.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for func_hooks-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 199aef1e3a3f603959716d5e9509a129620c080e287b78a4e3d315dc2e01452f |
|
MD5 | 0fb81ca936ae3dbea15ca1e5bb9005d4 |
|
BLAKE2b-256 | 03a069cd0e02bb4d6483374afae6e8023f87aaf100199ab0f1cc3ada6afbbaca |