git: 120e65ad6842 - main - devel/py-makefun: add port: Dynamically create python functions with a proper signature
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 26 Jan 2022 07:16:35 UTC
The branch main has been updated by tagattie: URL: https://cgit.FreeBSD.org/ports/commit/?id=120e65ad68426e6c9be44e99b3ffc45931fde288 commit 120e65ad68426e6c9be44e99b3ffc45931fde288 Author: Goran Mekić <meka@tilda.center> AuthorDate: 2022-01-26 07:13:28 +0000 Commit: Hiroki Tagato <tagattie@FreeBSD.org> CommitDate: 2022-01-26 07:16:09 +0000 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) --- devel/Makefile | 1 + devel/py-makefun/Makefile | 30 ++++++++++++++++++++++++++++++ devel/py-makefun/distinfo | 3 +++ devel/py-makefun/pkg-descr | 20 ++++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/devel/Makefile b/devel/Makefile index 815450176479..2566844bc5c2 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -4751,6 +4751,7 @@ SUBDIR += py-macholib SUBDIR += py-magic SUBDIR += py-mailcap-fix + SUBDIR += py-makefun SUBDIR += py-manuel SUBDIR += py-marrow.mailer SUBDIR += py-marrow.util diff --git a/devel/py-makefun/Makefile b/devel/py-makefun/Makefile new file mode 100644 index 000000000000..1ee54ed057c3 --- /dev/null +++ b/devel/py-makefun/Makefile @@ -0,0 +1,30 @@ +PORTNAME= makefun +PORTVERSION= 1.13.1 +CATEGORIES= devel python +MASTER_SITES= CHEESESHOP +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= meka@tilda.center +COMMENT= Dynamically create python functions with a proper signature + +LICENSE= BSD3CLAUSE +LICENSE_FILE= ${WRKSRC}/LICENSE + +BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pip>=0:devel/py-pip@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pytest-runner>=0:devel/py-pytest-runner@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}setuptools_scm>=0:devel/py-setuptools_scm@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR} +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}funcsigs>=0:devel/py-funcsigs@${PY_FLAVOR} +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR} + +USES= python:3.5-3.9 +USE_PYTHON= autoplist concurrent distutils + +TEST_ENV= PYTHONPATH=${WRKSRC}/src + +NO_ARCH= yes + +do-test: + cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest -v -rs -o addopts= + +.include <bsd.port.mk> diff --git a/devel/py-makefun/distinfo b/devel/py-makefun/distinfo new file mode 100644 index 000000000000..638e34a08e3a --- /dev/null +++ b/devel/py-makefun/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1643131820 +SHA256 (makefun-1.13.1.tar.gz) = 985bb8b670ffbbb95d2a8aa996d318e6e9a3f26fc6f3ef2da93ebdf8f9c616bf +SIZE (makefun-1.13.1.tar.gz) = 72170 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