Dynamically create python functions with a proper signature.
BSD-3-CLAUSE License
Bot releases are visible (Hide)
Published by smarie over 4 years ago
Fixed OSError: could not get source code
or IOError: could not get source code
when @compile_fun
is used on a function that depends on an already-compiled function. Fixed #51
See documentation page for details.
Published by smarie over 4 years ago
@compile_fun
: added capability to disable recursive compilation (recurse
arg) , and to exclude some names from compilation (except_names
arg). Fixed #49 and #50
Fixed issue ValueError: Cell is empty
with @compile_fun
. Fixed #48
Now raising an UndefinedSymbolError
when a symbol is not known at compilation time. One step towards #47
See documentation page for details.
Published by smarie over 4 years ago
New goodie @compile_fun
decorator to compile
a function so that it can not be navigated to using the debugger. Fixes #46
See documentation page for details.
Published by smarie almost 5 years ago
add_signature_parameters
now accepts that one specifies a custom index where to insert the new parameters.
See documentation page for details.
Published by smarie about 5 years ago
Added __version__
attribute to comply with PEP396, following this guide. Fixes #45.
See documentation page for details.
Published by smarie about 5 years ago
Fixed six
dependency: also declared as a setup dependency.
See documentation page for details.
Published by smarie about 5 years ago
Added missing six
dependency explicitly.
See documentation page for details.
Published by smarie over 5 years ago
get_signature_string
(used by all entry points) after profiling.See documentation page for details.
Published by smarie over 5 years ago
attrs
can modify the annotations manually, making signature
return a string representation that is not compliant with the language version. This raised a SyntaxError
in previous versions. The new version silently removes all these annotations in python versions that do not support them. Fixes #39.See documentation page for details.
Published by smarie over 5 years ago
See documentation page for details.
Published by smarie over 5 years ago
NameError
in case of unknown symbols in type hints. Fixes #37.Note also that this includes non-released 1.6.4 changelog
See documentation page for details.
Published by smarie over 5 years ago
Fixed bug when the return type annotation of the function to create contains non-locally available type hints. Fixes #33.
See documentation page for details.
Published by smarie over 5 years ago
Fixed bug when the signature of the function to create contains non-locally available type hints. Fixes #32.
See documentation page for details.
Published by smarie over 5 years ago
Fixed partial
to support missing and empty docstring. Fixes #31.
See documentation page for details.
Published by smarie over 5 years ago
New method partial
that behaves like functools.partial
, and equivalent decorator @with_partial
. Fixes #30.
See documentation page for details.
Published by smarie over 5 years ago
add_signature_parameters
now correctly inserts parameters in the right order when they are prepended (using first=
). Fixed #29.
See documentation page for details.
Published by smarie over 5 years ago
Function creation API:
handler
into impl
for clarity. Fixes #27.addsource
and addhandler
arguments as add_source
and add_impl
respectively, for consistency@wraps
or create_wrapper
, because that's probably what you want to do (= reuse not only the signature but also all metadata). Fixes #26.__qualname__
attributefunc_impl
in create_function
and @with_signature
, and are the ones from the wrapped function in create_wrapper
and @wraps
as intuitively expected. Fixes #28.Wrappers:
@wraps
and create_wrapper
now offer a new_sig
argument. In that case the __wrapped__
attribute is not set. Fixes #25.@wraps
and create_wrapper
now correctly preserve the __dict__
and other metadata from the wrapped item. Fixes #24
See documentation page for details.
Published by smarie over 5 years ago
When a non-representable default value was used in the signature to generate, the code failed with a SyntaxError
. This case is now correctly handled, by storing the corresponding variable in the generated function's context. Fixes #23.
See documentation page for details.
Published by smarie over 5 years ago
Now providing a @wraps
, equivalent of functools.wraps
; and a create_wrapper
equivalent of functools.update_wrapper
. Fixes #21
@with_signature
now does not override the __name__
when signature is provided as a function. Fixes #22
add_signature_parameters
now accepts that parameters are provided as single elements (not necessarily iterables)
Updated documentation
See documentation page for details.
Published by smarie over 5 years ago
None
can be used as the desired signature of @with_signature
. This indicated that the user does not want to create a new function but only wants to update the metadata. Fixes #20.
See documentation page for details.