Releases: smarie/python-makefun
0.4.0 - New `@with_signature` decorator, and `create_function` accepts functions
New decorator @with_signature to change the signature of a callable. Fixes #3
create_function now accepts that a function be passed as a signature template. Fixes #10
See documentation page for details.
0.3.0 - Ability to generate functions from `Signature`
Functions can now be created from a Signature object, in addition to string signatures. This unlocks many useful use cases, among easily creating function wrappers. Note: the inner function that provides this feature is get_signature_from_string. Fixes #8
Improved design by getting rid of the regular expression parser to check parameters definition. This assumes that the compiler will correctly raise exceptions when a string signature is not correct, and that inspect.signature or funcsigs.signature works correctly at detecting all the parameter kinds and annotations on the resulting function. It seems like a fair assumption... Fixes #9.
See documentation page for details.
0.2.0 - Various new features and improvements
create_function:
-
create_functiondoes not require users to prepend"def "to the signature anymore. Fixed #5 -
Return annotations are now supported. Fixes #4.
-
Type hint as comments are supported but the generated function loses the annotations because
inspect.signatureloses the annotation too in that case. Fixes #7 -
Variable-length arguments such as
*argsand**kwargsare now properly handled. Fixes #2 -
Handler functions can now receive the dynamically created function as first argument, by using
create_function(func_signature, func_handler, inject_as_first_arg=True). Fixes #1 -
Renamed
_call_into_call_handler_in the generated code.
Misc:
- Added
pytest-casesdependency for tests.
See documentation page for details.