aws-lambda-context
AWS Lambda Context class for type checking and testing
What it is and what it does
aws-lambda-context is a minimal library that exports the AWS Lambda Context class for use in Python Lambda handler functions. It serves two purposes: enabling static type checking of the context parameter in your handler via type hints (so mypy and IDEs can validate your code), and providing mock-friendly versions of the context and related classes for unit testing without invoking actual Lambda.
The package contains no runtime dependencies and is a pure Python module. It exports LambdaContext, LambdaCognitoIdentity, LambdaClientContext, and LambdaClientContextMobileClient as dataclass-like objects you can instantiate and configure in tests. The library is abandoned (last release July 2019) but marked stable; it works with Python 3.6 and later.
Use it for:
- Add type hints to Lambda handler functions so mypy and your IDE can catch context-related type errors before deployment.
- Mock the Lambda context object in unit tests without needing to invoke actual Lambda or AWS services.
- Build test fixtures that populate all context attributes (function name, request ID, Cognito identity, etc.) for deterministic handler testing.
- Enable editor auto-completion for context properties in your handler code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides the AWS Lambda Context class for type hints and mocking in Lambda handler functions, enabling type checking with mypy and editor auto-completion.
Yes, if you are type-checking existing Lambda handlers or writing tests for them and need the context class definition. The package is abandoned and will not receive updates, so it is suitable only for stable, long-lived codebases that do not expect the AWS Lambda context shape to change. If you need current AWS Lambda typing support, verify that the context class matches your runtime version.
Install
aws-lambda-context on PyPI
pip
pip install aws-lambda-contextuv
uv add aws-lambda-contextpoetry
poetry add aws-lambda-contextInstalling aws-lambda-context
Before you install
Low install friction with no runtime dependencies. Package is abandoned (last release 2019-07-17, 2585 days ago) but marked Production/Stable; use only if you accept no future maintenance.
License in practice
MIT license (permissive); you may use, modify, and distribute freely with attribution.
Quickstart
pip install aws-lambda-context
from aws_lambda_context import LambdaContext
def my_lambda_handler(event: Any, context: LambdaContext) -> None:
pass
Requires Python 3.6 or later.
Verify before relying
- Whether the LambdaContext class definition matches the current AWS Lambda runtime context object shape and all its attributes.
- Whether type checking with mypy works correctly with modern mypy versions given the package's age.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>= 3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,585 days since the last release |
| First released | |
| Downloads | 174,528/month — #10,280 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aws_lambda_context-1.1.0-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
apig-wsgiWraps a WSGI application to run as an AWS…
permissive · top 15,000 on PyPI
typishTypish provides runtime type checking and…
permissive · top 5,000 on PyPI
types-mockProvides type stubs for the mock library,…
permissive · top 5,000 on PyPI
pookpook intercepts and mocks HTTP traffic for…
permissive · top 15,000 on PyPI
pytest-mockProvides a pytest fixture that wraps the mock…
permissive · top 1,000 on PyPI
asyncmockProvides awaitable mock objects for testing…
permissive · top 15,000 on PyPI
typeapiProvides a unified API for reflecting and…
permissive · top 15,000 on PyPI
moto-extMocks AWS services for testing by intercepting…
permissive · top 15,000 on PyPI
freeze-uuidDecorator and context manager to mock Python's…
permissive · top 15,000 on PyPI
aws-lambda-typingProvides type hints and IDE autocomplete for…
permissive · top 5,000 on PyPI