Skip to content

Support Python applications as web functions - #521

Merged
GrahamCampbell merged 3 commits into
4.xfrom
web-functions-python315
Nov 26, 2026
Merged

GrahamCampbell merged 3 commits into
4.xfrom
web-functions-python315

Conversation

@GrahamCampbell

@GrahamCampbell GrahamCampbell commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Lambda offers the python3.15 runtime for web functions as a public preview, but osls only accepts the Node.js runtimes, and its handling of the entry point is specific to Node.js. A Python web function is an ASGI or WSGI application that Lambda serves, named as module:callable in the AWS_LAMBDA_PYTHON_ENTRYPOINT environment variable, with main:app as the default. This adds python3.15 to the web function runtimes and keeps entryPoint as the one property that names what Lambda loads: a file path for Node.js as before, and Lambda's own module:callable string for Python, optionally prefixed with asgi: or wsgi:, which osls passes on unchanged. A property with one format per runtime follows handler on functions, and avoids osls-only properties that would have to track a preview.

Validation follows what Lambda accepts in practice, which its documentation only partly covers: dotted modules, packages and attribute paths work, while a .py extension, a factory call or an upper-case prefix deploy successfully and then fail every request with status 502. The same happens when the module is missing, so packaging fails when the root of the package has neither the file nor the package of the module, as it already does for a missing Node.js entry file, also for a package.artifact. Both entry point variables are rejected in environment on every web function, since provider.environment is shared by the web functions of both languages. invoke local points to an ASGI or WSGI server for a Python web function.

The web functions guide gains a section on Python applications and on packaging their dependencies, which osls does not install: they have to be at the root of the package, built for Linux on arm64. Unlike the Python runtime of functions, this runtime does not include boto3. The default runtime stays nodejs26.x, so a Python web function has to set runtime.

Base automatically changed from web-functions-nodejs26 to 4.x November 26, 2026 21:04
@GrahamCampbell
GrahamCampbell force-pushed the web-functions-python315 branch from 70192da to eea0839 Compare November 26, 2026 21:06
@GrahamCampbell
GrahamCampbell force-pushed the web-functions-python315 branch from a6bbe98 to 435cc21 Compare November 26, 2026 21:35
@GrahamCampbell
GrahamCampbell merged commit cf9bc33 into 4.x Nov 26, 2026
8 checks passed
@GrahamCampbell
GrahamCampbell deleted the web-functions-python315 branch November 26, 2026 21:38
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.

1 participant