AWS-Lambda-Env-Modeler is a Python library (version 3.0.0, release cadence: irregular) that simplifies managing and validating environment variables in AWS Lambda functions using Python dataclasses, Pydantic models, or TypedDicts. It provides decorators and base classes to parse, validate, and cache environment configuration.
pip install aws-lambda-env-modelerVerified import paths — ran on the pinned version, not inferred.
Define an environment model using BaseModel, then decorate your Lambda handler with @parse_env. The parsed environment is attached to the context object. Alternatively, instantiate the model directly for testing.
Upgrade to Python 3.10+ or pin to aws-lambda-env-modeler==2.1.0
Replace `LambdaEnvModel` with `BaseModel` from the same package.
Pass `use_cache=False` to `parse_env` in tests: `@parse_env(model_class=MyEnv, use_cache=False)`.
Avoid changing env vars after the first invocation. If necessary, disable cache or use `force_refresh=True`.
Replace `LambdaEnvModel` with `BaseModel` or `EnvModel`.
Use `use_cache=False` instead of `cache=False`.
Install the latest version: `pip install --upgrade aws-lambda-env-modeler`. If on v1.x, use `from aws_lambda_env_modeler import LambdaEnvModel`.