diff options
author | Goran Mekić <meka@tilda.center> | 2022-01-26 07:13:28 +0000 |
---|---|---|
committer | Hiroki Tagato <tagattie@FreeBSD.org> | 2022-01-26 07:16:09 +0000 |
commit | 120e65ad68426e6c9be44e99b3ffc45931fde288 (patch) | |
tree | c75254a10dac9e36b35b5649a2fce36e83b75a36 /devel/py-makefun/pkg-descr | |
parent | bab091e20adef82f1a54d53430b8576c55a1759a (diff) | |
download | ports-120e65ad68426e6c9be44e99b3ffc45931fde288.tar.gz ports-120e65ad68426e6c9be44e99b3ffc45931fde288.zip |
devel/py-makefun: add port: Dynamically create python functions with a proper signature
Makefun helps you create functions dynamically, with the signature of your
choice. It was largely inspired by decorator and functools, and created mainly
to cover some of their limitations.
The typical use cases are:
* creating signature-preserving function wrappers - just like functools.wraps
but with accurate TypeError exception raising when user-provided arguments are
wrong, and with a very convenient way to access argument values.
* creating function wrappers that have more or less arguments that the
function they wrap. A bit like functools.partial but a lot more flexible and
friendly for your users. For example, I use it in my pytest plugins to add a
requests parameter to users' tests or fixtures when they do not already have
it.
* more generally, creating functions with a signature derived from a reference
signature, or even creating functions with a signature completely defined at
runtime.
WWW: https://github.com/smarie/python-makefun
PR: 260879
Reported by: Goran Mekić <meka@tilda.center> (new maintainer)
Diffstat (limited to 'devel/py-makefun/pkg-descr')
-rw-r--r-- | devel/py-makefun/pkg-descr | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/devel/py-makefun/pkg-descr b/devel/py-makefun/pkg-descr new file mode 100644 index 000000000000..043075309cca --- /dev/null +++ b/devel/py-makefun/pkg-descr @@ -0,0 +1,20 @@ +Makefun helps you create functions dynamically, with the signature of your +choice. It was largely inspired by decorator and functools, and created mainly +to cover some of their limitations. + +The typical use cases are: + * creating signature-preserving function wrappers - just like functools.wraps + but with accurate TypeError exception raising when user-provided arguments are + wrong, and with a very convenient way to access argument values. + + * creating function wrappers that have more or less arguments that the + function they wrap. A bit like functools.partial but a lot more flexible and + friendly for your users. For example, I use it in my pytest plugins to add a + requests parameter to users' tests or fixtures when they do not already have + it. + + * more generally, creating functions with a signature derived from a reference + signature, or even creating functions with a signature completely defined at + runtime. + +WWW: https://github.com/smarie/python-makefun |