Flask runtime (wsgi)#79
Open
94lama wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a new experimental Python Flask (WSGI) runtime alongside an example Flask action, aiming to enable running Flask apps under the OpenServerless runtime/proxy model.
Changes:
- Adds a new experimental runtime image definition for Flask (Dockerfile + pinned requirements).
- Implements a custom WSGI launcher that translates activation payloads into a WSGI
environand captures the WSGI response. - Adds a compile script and a sample Flask app package intended to run on the new runtime.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| runtime/experimental/python/flask/requirements.txt | Pins runtime Python dependencies (notably Flask). |
| runtime/experimental/python/flask/lib/launcher.py | New WSGI-based launcher translating OpenWhisk-style invocations into Flask/WSGI calls. |
| runtime/experimental/python/flask/Dockerfile | Builds the experimental Flask runtime container image. |
| runtime/experimental/python/flask/bin/compile | Packages user sources into the expected runtime layout and generates the exec wrapper. |
| packages/python/flask/app.py | Example Flask application intended to be deployed as an action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+136
to
+141
| try: | ||
| stderr.write("="*80 + "\n") | ||
| stderr.write("DEBUG: NEW REQUEST\n") | ||
| stderr.write("="*80 + "\n") | ||
| stderr.write(f"DEBUG: Incoming args: {json.dumps(args, indent=2)}\n") | ||
| stderr.write("-"*80 + "\n") |
Comment on lines
+167
to
+169
| for k, v in v.items(): | ||
| if k.lower() == "x-scheme": environ["wsgi.url_scheme"] = v | ||
| else: environ[k.upper().replace("-", "_")] = v |
|
|
||
| environ = { | ||
| "wsgi.version": (1, 0), | ||
| "wsgi.url_scheme": "HTTP", |
Comment on lines
+61
to
+66
| def start_response(status, headers): | ||
| global response_status | ||
| global response_headers | ||
| response_status = status | ||
| response_headers = headers | ||
| return [] |
Comment on lines
+132
to
+135
|
|
||
| reset_environ() | ||
| res = {} | ||
|
|
Comment on lines
+21
to
+23
| import base64 | ||
| import urllib.parse | ||
| import sys, os, json, traceback, requests |
Comment on lines
+18
to
+19
| #ARG COMMON=missing:missing | ||
| ARG COMMON=registry.hub.docker.com/apache/openserverless-runtime-common:common1.18.4 |
Comment on lines
+129
to
+134
| line = stdin.readline() | ||
| if not line: break | ||
| args = json.loads(line) | ||
|
|
||
| reset_environ() | ||
| res = {} |
Comment on lines
+75
to
+76
| "wsgi.multiprocess": True, | ||
| "wsgi.run_once": True, |
Comment on lines
+122
to
+125
| return { | ||
| "statusCode": status_code, | ||
| "headers": headers_dict, | ||
| "body": response_body.decode('utf-8') if isinstance(response_body, bytes) else response_body, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.