skillfed

aws-lambda-context

AWS Lambda Context class for type checking and testing

aws-lambda-context v1.1.0 174.5K downloads/30d#10,280 on PyPI
Permissive license Abandoned released

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-context

uv

uv add aws-lambda-context

poetry

poetry add aws-lambda-context

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7

Tags

aws lambda context type hintslambda handler type checkingmock lambda context testingaws lambda typinglambda function type annotationslambda context mockpython lambda type hints
aws-lambdatype-hintstesting

More Testing packages