Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Declarative function signatures for python #160

Merged
merged 13 commits into from
Oct 26, 2021
Merged

Conversation

KaylaNguyen
Copy link
Contributor

@KaylaNguyen KaylaNguyen commented Oct 22, 2021

Allow users to systematically register their function signature type:

import functions_framework 

@function_framework.cloudevent
def hello_cloudevent(cloudevent):
    print("Hello")

@function_framework.http
def hello_http(request):
    print("Hello")

User signature type is searched in the following order:

  • Decorator user used to register their function (new behavior)
  • --signature-type flag (current behavior)
  • environment variable FUNCTION_SIGNATURE_TYPE (current behavior)

If none of the above is set, signature type defaults to be "http".

@google-cla google-cla bot added the cla: yes label Oct 22, 2021
@KaylaNguyen KaylaNguyen linked an issue Oct 22, 2021 that may be closed by this pull request
@KaylaNguyen KaylaNguyen changed the title Declarative function signatures for python feat!: Declarative function signatures for python Oct 22, 2021
Copy link
Contributor

@grant grant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR. I've requested a few changes.

Copy link
Contributor

@grant grant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing further, I don't think we want to support @function_framework.event, following the Node implementation and CloudEvent future interface for events.

Copy link
Member

@matthewrobertson matthewrobertson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@KaylaNguyen KaylaNguyen merged commit 52b2a28 into master Oct 26, 2021
@KaylaNguyen KaylaNguyen deleted the declarative-ff branch October 26, 2021 22:21
@KaylaNguyen KaylaNguyen changed the title feat!: Declarative function signatures for python feat: Declarative function signatures for python Oct 29, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Declarative Function Signatures
5 participants