skillfed

apig-wsgi

Wrap a WSGI application in an AWS Lambda handler function for running on API Gateway or an ALB.

apig-wsgi v2.20.0 141.9K downloads/30d#11,230 on PyPI173
Permissive license MIT Active released

What it is and what it does

apig-wsgi is a thin adapter that lets you run existing WSGI applications on AWS Lambda by converting API Gateway and ALB events into WSGI environ dicts and wrapping responses back into the appropriate format. It handles both event format versions automatically, manages binary content encoding, and exposes Lambda context and request metadata through WSGI environ keys so your application can access AWS-specific details if needed.

The package has no runtime dependencies and installs cleanly. It's designed for teams deploying WSGI applications to serverless without rewriting the application layer. Configuration is minimal: you create a lambda_handler by passing your WSGI app to make_lambda_handler(), then deploy that function to Lambda. The package handles format detection, multi-value headers on format version 1, and conditional base64 encoding of binary responses.

Use it for:

  • Deploy a WSGI application behind an ALB in Lambda for cost-effective serverless HTTP handling.
  • Run a WSGI app on a Lambda Function URL with automatic binary response support.
  • Support both API Gateway REST and HTTP APIs with a single handler that auto-detects the event format.
  • Access Lambda context and API Gateway request metadata from within your WSGI application.
  • Wrap an existing WSGI application for Lambda without modifying application code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Wraps a WSGI application to run as an AWS Lambda handler on API Gateway, Lambda Function URLs, or ALBs, automatically detecting event format versions and handling binary responses.

Yes. This is a mature, actively maintained bridge for running WSGI applications on AWS Lambda. It has no dependencies, low install friction, clean MIT licensing, and zero known vulnerabilities. Install it if you're deploying a WSGI application to Lambda.

Install

apig-wsgi on PyPI

pip

pip install apig-wsgi

uv

uv add apig-wsgi

poetry

poetry add apig-wsgi

Installing apig-wsgi

Before you install

Low friction install with no runtime dependencies. Active maintenance with recent releases; last commit 2026-08-13.

License in practice

MIT license permits commercial and private use with minimal restrictions; suitable for most projects.

Quickstart

pip install apig-wsgi

from apig_wsgi import make_lambda_handler

lambda_handler = make_lambda_handler(app)

Requires Python 3.9 or later. Your WSGI application must be deployable to AWS Lambda with appropriate IAM permissions.

Verify before relying

  • Whether binary response support requires additional AWS configuration beyond what the package handles automatically.
  • Performance characteristics and cold-start overhead compared to native Lambda frameworks.
  • Specific Django and Flask compatibility versions beyond general WSGI support.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 340 days since the last release
Last repo commit
First released
Downloads 141,923/month — #11,230 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: apig_wsgi-2.20.0-py3-none-any.whl

Keywords: API Gateway, APIG, AWS, Lambda

Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Typing :: Typed

Tags

aws lambda wsgi adapterapi gateway lambda handlerserverless wsgi wrapperalb lambda wsgilambda function url handlerwsgi to lambda converterlambda http handler
aws-lambdawsgi-adapterserverless

More Dynamic Content packages