Skip to content

feat: support asgi frameworks directly in asgi mode #382

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Jun 20, 2025

This PR enables the Functions Framework to automatically detect and run ASGI web frameworks like FastAPI and Starlette. When the framework detects an ASGI app, functions framework handles the set up without requiring any special configuration.

This allows developers to easily deploy modern Python web frameworks with their full feature set (routing, middleware, validation) to Cloud Run functions.

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"message": "Hello World"}

@app.get("/items/{item_id}")
def read_item(item_id: int):
    return {"item_id": item_id}

Load the app in functions framework:

functions-framework --target app --asgi

@taeold taeold changed the title feat: support asgi apps. feat: support asgi frameworks directly in asgi mode Jun 20, 2025
@taeold taeold marked this pull request as ready for review June 20, 2025 02:06
@taeold taeold requested a review from maemayve June 20, 2025 02:06
@maemayve
Copy link
Member

Seems to me that this is offering a path for deploying python code that doesn't conform with the Functions API definition. I think we need to review with the product specification to determine if this is an approach that works with the intent of the framework

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants