Skip to content

Flask runtime (wsgi)#79

Open
94lama wants to merge 2 commits into
apache:mainfrom
94lama:flask
Open

Flask runtime (wsgi)#79
94lama wants to merge 2 commits into
apache:mainfrom
94lama:flask

Conversation

@94lama
Copy link
Copy Markdown

@94lama 94lama commented May 4, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 4, 2026 09:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 environ and 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,
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