Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Untyped functions_framework.http #190

Closed
racinmat opened this issue Jun 9, 2022 · 2 comments · Fixed by #248
Closed

Untyped functions_framework.http #190

racinmat opened this issue Jun 9, 2022 · 2 comments · Fixed by #248
Assignees
Labels
enhancement New feature or request

Comments

@racinmat
Copy link

racinmat commented Jun 9, 2022

The decorator functions_framework.http is untyped, leading to Untyped decorator makes function "main" untyped errors when using mypy.
Would it be possible to add mypy typing? Thanks.

@grant
Copy link
Contributor

grant commented Jun 10, 2022

Sounds reasonable.

I attempted to add more types here:

#191

@christippett
Copy link

I wrote the snippet below for another project. It's pulling in the same types used by Flask, so things like the request object and expected return type for function handlers are all properly annotated and play nice with intellisense.

Given Flask is already included as a dependency in the functions framework, it might be worth piggybacking on the types defined in flask.typing

from flask.typing import RouteCallable

def http(func: RouteCallable) -> RouteCallable:
    """Decorator that registers http as user function signature type."""
    ...

@josephlewis42 josephlewis42 added the enhancement New feature or request label Feb 24, 2023
multani added a commit to multani/functions-framework-python that referenced this issue May 30, 2023
This adds type annotations for the 2 main decorators of the library.

Closes: GoogleCloudPlatform#190
multani added a commit to multani/functions-framework-python that referenced this issue May 30, 2023
This adds type annotations for the 2 main decorators of the library.

Closes: GoogleCloudPlatform#190
multani added a commit to multani/functions-framework-python that referenced this issue May 30, 2023
This adds type annotations for the 2 main decorators of the library.

Closes: GoogleCloudPlatform#190
multani added a commit to multani/functions-framework-python that referenced this issue May 30, 2023
This adds type annotations for the 2 main decorators of the library.

Closes: GoogleCloudPlatform#190
garethgeorge added a commit that referenced this issue Aug 28, 2023
* Initial typing of the public API

This adds type annotations for the 2 main decorators of the library.

Closes: #190

* fix typing

* Remove zip_safe flag, as it's not needed anymore.

* run black

* fix import order

---------

Co-authored-by: Gareth <garethgeorge@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants