-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Labels
Description
Simply put, defining a function with the @functions_framework.http decorator does not support type hints. With some digging, I stumbled upon the possibility of using @functions_framework.typed, but even this does not work, nor is it documented anywhere. Please see:
This is taken from my attempts to create and deploy a function running python version 3.12.x. There are no error messages indicating that the cause is the type hints, only that the function failed to be ready and accepting of traffic.
I would suggest the following:
- Type hints be properly supported for Python functions running any compatible version, given they are now standard practice for developers
- Versions that use type hinting when they shouldn't -- or otherwise cannot be built -- show an appropriate and relevant error message
As for an example, even the most basic functions such as the following will break:
from flask import Request
@functions_framework.http
def main(request: Request):
passfrom flask import Request
@functions_framework.typed
def main(request: Request):
pass