Skip to content

Add FastAPI framework support to Oryx#2904

Merged
Saipriya-1144 merged 23 commits intomainfrom
user/vchintalapat/onboard-fastapi-detection
Apr 29, 2026
Merged

Add FastAPI framework support to Oryx#2904
Saipriya-1144 merged 23 commits intomainfrom
user/vchintalapat/onboard-fastapi-detection

Conversation

@Saipriya-1144
Copy link
Copy Markdown
Collaborator

@Saipriya-1144 Saipriya-1144 commented Apr 20, 2026

This PR onboards FastAPI as a first-class detected framework in Oryx, alongside Django and Flask.

How detection works
During startup, the script generator scans the app directory for common entry files — main.py, app.py, application.py, server.py — and looks for "from fastapi import" or "FastAPI(" in their contents. Detection runs in priority order: Django → FastAPI → Flask, so if an app somehow imports both FastAPI and Flask, FastAPI wins.

How the app starts
Once detected, Oryx generates a Gunicorn startup command with Uvicorn workers:

gunicorn --timeout 600 --access-logfile '-' --error-logfile '-' -c /opt/startup/gunicorn.conf.py --chdir=/tmp/8dea620f57fccb8" gunicorn -k uvicorn_worker.UvicornWorker main:app

FastAPI is ASGI, so it needs Uvicorn workers instead of Gunicorn's default sync workers. Gunicorn acts as the process manager (timeouts, restarts, worker scaling) while Uvicorn handles the async protocol.

Debug mode
In debug mode, Oryx skips Gunicorn entirely and runs:

python -m debugpy --listen 0.0.0.0:5678 -m uvicorn main:app --host 0.0.0.0 --port 8000Added Go startup script generator tests to unit-tests.yaml — they now run on every PR and push to main.

Added Go startup script generator tests to unit-tests.yaml — they now run on every PR and push to main.

Testing:
Created a runtime image with these changes and deployed a fastapi app

For python 3.14:
image

For python 3.13:
Deployed the same fastapi app as above, but it detected the app as flask - as expected
image

image

Debug mode:
image
image

  • The purpose of this PR is explained in this message or in an issue. If an issue please include a reference as #<issue_number>.
  • Tests are included and/or updated for code changes.
  • Proper license headers are included in each file.

Comment thread src/startupscriptgenerator/src/node/scriptgenerator_test.go
@Saipriya-1144 Saipriya-1144 marked this pull request as ready for review April 20, 2026 12:36
@Saipriya-1144 Saipriya-1144 requested a review from a team as a code owner April 20, 2026 12:36
Comment thread tests/Oryx.Integration.Tests/Python/PythonFastAPIAppTests.cs
@Saipriya-1144 Saipriya-1144 changed the title Onboard fastapi detection Add FastAPI framework support to Oryx Apr 20, 2026
Comment thread src/startupscriptgenerator/src/python/frameworks.go
Comment thread images/runtime/python/noble.Dockerfile Outdated
Comment thread images/runtime/python/noble.Dockerfile Outdated
Comment thread src/startupscriptgenerator/src/python/frameworks.go Outdated
Comment thread src/startupscriptgenerator/src/python/scriptgenerator_test.go Outdated
Comment thread src/startupscriptgenerator/src/python/frameworks.go
Comment thread images/runtime/python/template.Dockerfile Outdated
Comment thread src/startupscriptgenerator/src/python/frameworks.go
Comment thread tests/SampleApps/python/fastapi-app/requirements.txt Outdated
Comment thread src/startupscriptgenerator/src/python/frameworks.go Outdated
@Saipriya-1144 Saipriya-1144 merged commit 8454061 into main Apr 29, 2026
9 checks passed
@Saipriya-1144 Saipriya-1144 deleted the user/vchintalapat/onboard-fastapi-detection branch April 29, 2026 11:03
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.

7 participants