You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is tracking implementing declarative function signatures in python.
This feature allows a functions framework to optionally detect the user code's function signature without specifying a --signature-type / FUNCTION_SIGNATURE_TYPE config. It may require a code change for the user.
A possible implementation for python may look like this:
@functions_framework.http("hello")defhello(request):
return"Hello world!"@functions_framework.cloudevent("ce")deffunction_name_does_not_matter(cloudevent):
print(f"Received event with ID: {cloudevent['id']}")
The function (i.e. hello) would be invoked at localhost:8080/hello.
The functions-framework CLI would load all/any registered functions if available.
Note: The function name would not change the URL route or be used.
I think a decorator like this would be most clear, but other designs would be fine. As noted in the FF contract, event is not a requirement.
This issue is tracking implementing declarative function signatures in python.
This feature allows a functions framework to optionally detect the user code's function signature without specifying a
--signature-type
/FUNCTION_SIGNATURE_TYPE
config. It may require a code change for the user.A possible implementation for python may look like this:
The function (i.e.
hello
) would be invoked atlocalhost:8080/hello
.The
functions-framework
CLI would load all/any registered functions if available.I think a decorator like this would be most clear, but other designs would be fine. As noted in the FF contract,
event
is not a requirement.See:
CC: @matthewrobertson @anniefu
The text was updated successfully, but these errors were encountered: