aws-lambda-env-modeler 2.1.0__tar.gz → 4.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -251,3 +251,5 @@ lib_requirements.txt
251
251
  .ruff_cache
252
252
  .poetry
253
253
  .pytest_cache
254
+ node_modules
255
+ package-lock.json
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Ran Isenberg
3
+ Copyright (c) 2026 Ran Isenberg
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: aws_lambda_env_modeler
3
- Version: 2.1.0
3
+ Version: 4.0.0
4
4
  Summary: AWS-Lambda-Env-Modeler is a Python library designed to simplify the process of managing and validating environment variables in your AWS Lambda functions.
5
5
  Project-URL: Repository, https://github.com/ran-isenberg/aws-lambda-env-modeler
6
6
  Project-URL: Issue tracker, https://github.com/ran-isenberg/aws-lambda-env-modeler/issues
@@ -13,21 +13,20 @@ Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: License :: OSI Approved :: MIT License
15
15
  Classifier: Natural Language :: English
16
- Classifier: Programming Language :: Python :: 3.9
17
- Classifier: Programming Language :: Python :: 3.10
18
16
  Classifier: Programming Language :: Python :: 3.11
19
17
  Classifier: Programming Language :: Python :: 3.12
20
18
  Classifier: Programming Language :: Python :: 3.13
21
19
  Classifier: Programming Language :: Python :: 3.14
22
- Requires-Python: <4,>=3.9.0
20
+ Classifier: Programming Language :: Python :: 3.15
21
+ Requires-Python: <4,>=3.11.0
23
22
  Requires-Dist: pydantic<3,>=2.12.0
24
23
  Description-Content-Type: text/markdown
25
24
 
26
25
 
27
26
  # AWS Lambda Environment Variables Modeler (Python)
28
27
 
29
- [![license](https://img.shields.io/github/license/ran-isenberg/aws-lambda-env-modeler)](https://github.com/ran-isenberg/aws-lambda-env-modeler/blob/master/LICENSE)
30
- ![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.9|%203.10|%203.11|%203.12|%203.13|%203.14&color=blue?style=flat-square&logo=python)
28
+ [![license](https://img.shields.io/github/license/ran-isenberg/aws-lambda-env-modeler)](https://github.com/ran-isenberg/aws-lambda-env-modeler/blob/main/LICENSE)
29
+ ![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.11|%203.12|%203.13|%203.14|%203.15&color=blue?style=flat-square&logo=python)
31
30
  ![PyPI version](https://badge.fury.io/py/aws-lambda-env-modeler.svg)
32
31
  ![PyPi monthly downloads](https://img.shields.io/pypi/dm/aws-lambda-env-modeler)
33
32
  [![PyPI Downloads](https://static.pepy.tech/badge/aws-lambda-env-modeler)](https://pepy.tech/projects/aws-lambda-env-modeler)
@@ -36,15 +35,15 @@ Description-Content-Type: text/markdown
36
35
  ![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ran-isenberg/aws-lambda-env-modeler/badge)
37
36
  ![issues](https://img.shields.io/github/issues/ran-isenberg/aws-lambda-env-modeler)
38
37
 
39
- ![alt text](https://github.com/ran-isenberg/aws-lambda-env-modeler/blob/main/docs/media/banner.png?raw=true)
38
+ <a href="https://www.ranthebuilder.cloud/"><img alt="Ran The Builder - AI Adoption, Platform Engineering, AWS Serverless" src="https://ranthebuilder.cloud/images/og-image-v2.jpg" width="400" /></a>
40
39
 
41
40
  AWS-Lambda-Env-Modeler is a Python library designed to simplify the process of managing and validating environment variables in your AWS Lambda functions.
42
41
 
43
- It leverages the power of [Pydantic](https://pydantic-docs.helpmanual.io/) models to define the expected structure and types of the environment variables.
42
+ It leverages the power of [Pydantic](https://docs.pydantic.dev/latest/) models to define the expected structure and types of the environment variables.
44
43
 
45
44
  This library is especially handy for serverless applications where managing configuration via environment variables is a common practice.
46
45
 
47
- **[📜Documentation](https://ran-isenberg.github.io/aws-lambda-env-modeler/)** | **[Blogs website](https://www.ranthebuilder.cloud)**
46
+ **[📜Documentation](https://ran-isenberg.github.io/aws-lambda-env-modeler/)** | **[Website](https://www.ranthebuilder.cloud)**
48
47
  > **Contact details | ran.isenberg@ranthebuilder.cloud**
49
48
 
50
49
 
@@ -61,12 +60,12 @@ This usage may cause nasty bugs or even crashes in production.
61
60
 
62
61
  This library allows you to correctly parse, validate, and use your environment variables in your Python AWS Lambda code.
63
62
 
64
- Read more about it [here](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-environment-variables)
63
+ Read more about it in the [AWS Lambda environment variables article on the Ran The Builder website](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-environment-variables).
65
64
 
66
65
  ### **Features**
67
66
 
68
67
  - Validates the environment variables against a Pydantic model: define both semantic and syntactic validation.
69
- - Serializes the string environment variables into complex classes and types.
68
+ - Parses the string environment variables into complex classes and types.
70
69
  - Provides means to access the environment variables safely with a global getter function in every part of the function.
71
70
  - Provides a decorator to initialize the environment variables before executing a function.
72
71
  - Caches the parsed model for performance improvement for multiple 'get' calls.
@@ -74,14 +73,22 @@ Read more about it [here](https://www.ranthebuilder.cloud/post/aws-lambda-cookbo
74
73
 
75
74
  ## Installation
76
75
 
76
+ Supported Python versions: 3.11, 3.12, 3.13, 3.14 and 3.15. Python 3.10 is no longer supported, as it is deprecated. See the [AWS Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) page for further information.
77
+
77
78
  You can install it using pip:
78
79
 
79
80
  ```bash
80
81
  pip install aws-lambda-env-modeler
81
82
  ```
82
83
 
84
+ or uv:
85
+
86
+ ```bash
87
+ uv add aws-lambda-env-modeler
88
+ ```
89
+
83
90
  ## Getting started
84
- Head over to the complete project documentation pages at GitHub pages at [https://ran-isenberg.github.io/aws-lambda-env-modeler](https://ran-isenberg.github.io/aws-lambda-env-modeler/)
91
+ Head over to the complete documentation at [https://ran-isenberg.github.io/aws-lambda-env-modeler](https://ran-isenberg.github.io/aws-lambda-env-modeler/)
85
92
 
86
93
 
87
94
  ## Usage
@@ -90,12 +97,13 @@ First, define a Pydantic model for your environment variables:
90
97
  ```python
91
98
  from pydantic import BaseModel, HttpUrl
92
99
 
100
+
93
101
  class MyEnvVariables(BaseModel):
94
102
  DB_HOST: str
95
103
  DB_PORT: int
96
104
  DB_USER: str
97
105
  DB_PASS: str
98
- FLAG_X: bool
106
+ FLAG_X: bool
99
107
  API_URL: HttpUrl
100
108
  ```
101
109
 
@@ -103,23 +111,22 @@ Before executing a function, you must use the `@init_environment_variables` deco
103
111
 
104
112
  The decorator guarantees that the function will run with the correct variable configuration.
105
113
 
106
- Then, you can fetch the environment variables using the global getter function, 'get_environment_variables,' and use them just like a data class. At this point, they are parsed and validated.
107
-
108
114
  ```python
109
115
  from aws_lambda_env_modeler import init_environment_variables
110
116
 
111
- @init_environment_variables(MyEnvVariables)
117
+
118
+ @init_environment_variables(model=MyEnvVariables)
112
119
  def my_handler_entry_function(event, context):
113
120
  # At this point, environment variables are already validated and initialized
114
121
  pass
115
122
  ```
116
123
 
117
- Then, you can fetch and validate the environment variables with your model:
124
+ Then, you can fetch the environment variables using the global getter function, 'get_environment_variables,' and use them just like a data class. At this point, they are parsed and validated.
118
125
 
119
126
  ```python
120
127
  from aws_lambda_env_modeler import get_environment_variables
121
128
 
122
- env_vars = get_environment_variables(MyEnvVariables)
129
+ env_vars = get_environment_variables(model=MyEnvVariables)
123
130
  print(env_vars.DB_HOST)
124
131
  ```
125
132
 
@@ -127,20 +134,19 @@ print(env_vars.DB_HOST)
127
134
 
128
135
  By default, the modeler uses cache - the parsed model is cached for performance improvement for multiple 'get' calls.
129
136
 
130
- In some cases, such as during testing, you may want to turn off the cache. You can do this by setting the `LAMBDA_ENV_MODELER_DISABLE_CACHE` environment variable to 'True.'
137
+ In some cases, such as during testing, you may want to turn off the cache. You can do this by setting the `LAMBDA_ENV_MODELER_DISABLE_CACHE` environment variable to `true`.
131
138
 
132
- This is especially useful in tests where you want to run multiple tests concurrently, each with a different set of environment variables.
139
+ This is especially useful in tests where each test sets a different set of environment variables for the same model.
133
140
 
134
141
  Here's an example of how you can use this in a pytest test:
135
142
 
136
143
  ```python
137
144
  import json
138
145
  from http import HTTPStatus
139
- from typing import Any, Dict
146
+ from typing import Any, Dict, Literal
140
147
  from unittest.mock import patch
141
148
 
142
149
  from pydantic import BaseModel
143
- from typing_extensions import Literal
144
150
 
145
151
  from aws_lambda_env_modeler import LAMBDA_ENV_MODELER_DISABLE_CACHE, get_environment_variables, init_environment_variables
146
152
 
@@ -176,7 +182,7 @@ Read our code of conduct [here.](https://github.com/ran-isenberg/aws-lambda-env-
176
182
 
177
183
  ## Connect
178
184
  * Email: [ran.isenberg@ranthebuilder.cloud](mailto:ran.isenberg@ranthebuilder.cloud)
179
- * Blog Website [RanTheBuilder](https://www.ranthebuilder.cloud)
185
+ * Website [RanTheBuilder](https://www.ranthebuilder.cloud)
180
186
  * LinkedIn: [ranisenberg](https://www.linkedin.com/in/ranisenberg/)
181
187
  * Twitter: [RanBuilder](https://twitter.com/RanBuilder)
182
188
  * Bluesky: [@ranthebuilder.cloud](https://bsky.app/profile/ranthebuilder.cloud)
@@ -1,8 +1,8 @@
1
1
 
2
2
  # AWS Lambda Environment Variables Modeler (Python)
3
3
 
4
- [![license](https://img.shields.io/github/license/ran-isenberg/aws-lambda-env-modeler)](https://github.com/ran-isenberg/aws-lambda-env-modeler/blob/master/LICENSE)
5
- ![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.9|%203.10|%203.11|%203.12|%203.13|%203.14&color=blue?style=flat-square&logo=python)
4
+ [![license](https://img.shields.io/github/license/ran-isenberg/aws-lambda-env-modeler)](https://github.com/ran-isenberg/aws-lambda-env-modeler/blob/main/LICENSE)
5
+ ![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.11|%203.12|%203.13|%203.14|%203.15&color=blue?style=flat-square&logo=python)
6
6
  ![PyPI version](https://badge.fury.io/py/aws-lambda-env-modeler.svg)
7
7
  ![PyPi monthly downloads](https://img.shields.io/pypi/dm/aws-lambda-env-modeler)
8
8
  [![PyPI Downloads](https://static.pepy.tech/badge/aws-lambda-env-modeler)](https://pepy.tech/projects/aws-lambda-env-modeler)
@@ -11,15 +11,15 @@
11
11
  ![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ran-isenberg/aws-lambda-env-modeler/badge)
12
12
  ![issues](https://img.shields.io/github/issues/ran-isenberg/aws-lambda-env-modeler)
13
13
 
14
- ![alt text](https://github.com/ran-isenberg/aws-lambda-env-modeler/blob/main/docs/media/banner.png?raw=true)
14
+ <a href="https://www.ranthebuilder.cloud/"><img alt="Ran The Builder - AI Adoption, Platform Engineering, AWS Serverless" src="https://ranthebuilder.cloud/images/og-image-v2.jpg" width="400" /></a>
15
15
 
16
16
  AWS-Lambda-Env-Modeler is a Python library designed to simplify the process of managing and validating environment variables in your AWS Lambda functions.
17
17
 
18
- It leverages the power of [Pydantic](https://pydantic-docs.helpmanual.io/) models to define the expected structure and types of the environment variables.
18
+ It leverages the power of [Pydantic](https://docs.pydantic.dev/latest/) models to define the expected structure and types of the environment variables.
19
19
 
20
20
  This library is especially handy for serverless applications where managing configuration via environment variables is a common practice.
21
21
 
22
- **[📜Documentation](https://ran-isenberg.github.io/aws-lambda-env-modeler/)** | **[Blogs website](https://www.ranthebuilder.cloud)**
22
+ **[📜Documentation](https://ran-isenberg.github.io/aws-lambda-env-modeler/)** | **[Website](https://www.ranthebuilder.cloud)**
23
23
  > **Contact details | ran.isenberg@ranthebuilder.cloud**
24
24
 
25
25
 
@@ -36,12 +36,12 @@ This usage may cause nasty bugs or even crashes in production.
36
36
 
37
37
  This library allows you to correctly parse, validate, and use your environment variables in your Python AWS Lambda code.
38
38
 
39
- Read more about it [here](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-environment-variables)
39
+ Read more about it in the [AWS Lambda environment variables article on the Ran The Builder website](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-environment-variables).
40
40
 
41
41
  ### **Features**
42
42
 
43
43
  - Validates the environment variables against a Pydantic model: define both semantic and syntactic validation.
44
- - Serializes the string environment variables into complex classes and types.
44
+ - Parses the string environment variables into complex classes and types.
45
45
  - Provides means to access the environment variables safely with a global getter function in every part of the function.
46
46
  - Provides a decorator to initialize the environment variables before executing a function.
47
47
  - Caches the parsed model for performance improvement for multiple 'get' calls.
@@ -49,14 +49,22 @@ Read more about it [here](https://www.ranthebuilder.cloud/post/aws-lambda-cookbo
49
49
 
50
50
  ## Installation
51
51
 
52
+ Supported Python versions: 3.11, 3.12, 3.13, 3.14 and 3.15. Python 3.10 is no longer supported, as it is deprecated. See the [AWS Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) page for further information.
53
+
52
54
  You can install it using pip:
53
55
 
54
56
  ```bash
55
57
  pip install aws-lambda-env-modeler
56
58
  ```
57
59
 
60
+ or uv:
61
+
62
+ ```bash
63
+ uv add aws-lambda-env-modeler
64
+ ```
65
+
58
66
  ## Getting started
59
- Head over to the complete project documentation pages at GitHub pages at [https://ran-isenberg.github.io/aws-lambda-env-modeler](https://ran-isenberg.github.io/aws-lambda-env-modeler/)
67
+ Head over to the complete documentation at [https://ran-isenberg.github.io/aws-lambda-env-modeler](https://ran-isenberg.github.io/aws-lambda-env-modeler/)
60
68
 
61
69
 
62
70
  ## Usage
@@ -65,12 +73,13 @@ First, define a Pydantic model for your environment variables:
65
73
  ```python
66
74
  from pydantic import BaseModel, HttpUrl
67
75
 
76
+
68
77
  class MyEnvVariables(BaseModel):
69
78
  DB_HOST: str
70
79
  DB_PORT: int
71
80
  DB_USER: str
72
81
  DB_PASS: str
73
- FLAG_X: bool
82
+ FLAG_X: bool
74
83
  API_URL: HttpUrl
75
84
  ```
76
85
 
@@ -78,23 +87,22 @@ Before executing a function, you must use the `@init_environment_variables` deco
78
87
 
79
88
  The decorator guarantees that the function will run with the correct variable configuration.
80
89
 
81
- Then, you can fetch the environment variables using the global getter function, 'get_environment_variables,' and use them just like a data class. At this point, they are parsed and validated.
82
-
83
90
  ```python
84
91
  from aws_lambda_env_modeler import init_environment_variables
85
92
 
86
- @init_environment_variables(MyEnvVariables)
93
+
94
+ @init_environment_variables(model=MyEnvVariables)
87
95
  def my_handler_entry_function(event, context):
88
96
  # At this point, environment variables are already validated and initialized
89
97
  pass
90
98
  ```
91
99
 
92
- Then, you can fetch and validate the environment variables with your model:
100
+ Then, you can fetch the environment variables using the global getter function, 'get_environment_variables,' and use them just like a data class. At this point, they are parsed and validated.
93
101
 
94
102
  ```python
95
103
  from aws_lambda_env_modeler import get_environment_variables
96
104
 
97
- env_vars = get_environment_variables(MyEnvVariables)
105
+ env_vars = get_environment_variables(model=MyEnvVariables)
98
106
  print(env_vars.DB_HOST)
99
107
  ```
100
108
 
@@ -102,20 +110,19 @@ print(env_vars.DB_HOST)
102
110
 
103
111
  By default, the modeler uses cache - the parsed model is cached for performance improvement for multiple 'get' calls.
104
112
 
105
- In some cases, such as during testing, you may want to turn off the cache. You can do this by setting the `LAMBDA_ENV_MODELER_DISABLE_CACHE` environment variable to 'True.'
113
+ In some cases, such as during testing, you may want to turn off the cache. You can do this by setting the `LAMBDA_ENV_MODELER_DISABLE_CACHE` environment variable to `true`.
106
114
 
107
- This is especially useful in tests where you want to run multiple tests concurrently, each with a different set of environment variables.
115
+ This is especially useful in tests where each test sets a different set of environment variables for the same model.
108
116
 
109
117
  Here's an example of how you can use this in a pytest test:
110
118
 
111
119
  ```python
112
120
  import json
113
121
  from http import HTTPStatus
114
- from typing import Any, Dict
122
+ from typing import Any, Dict, Literal
115
123
  from unittest.mock import patch
116
124
 
117
125
  from pydantic import BaseModel
118
- from typing_extensions import Literal
119
126
 
120
127
  from aws_lambda_env_modeler import LAMBDA_ENV_MODELER_DISABLE_CACHE, get_environment_variables, init_environment_variables
121
128
 
@@ -151,7 +158,7 @@ Read our code of conduct [here.](https://github.com/ran-isenberg/aws-lambda-env-
151
158
 
152
159
  ## Connect
153
160
  * Email: [ran.isenberg@ranthebuilder.cloud](mailto:ran.isenberg@ranthebuilder.cloud)
154
- * Blog Website [RanTheBuilder](https://www.ranthebuilder.cloud)
161
+ * Website [RanTheBuilder](https://www.ranthebuilder.cloud)
155
162
  * LinkedIn: [ranisenberg](https://www.linkedin.com/in/ranisenberg/)
156
163
  * Twitter: [RanBuilder](https://twitter.com/RanBuilder)
157
164
  * Bluesky: [@ranthebuilder.cloud](https://bsky.app/profile/ranthebuilder.cloud)
@@ -8,7 +8,7 @@ from aws_lambda_env_modeler.types import Model
8
8
  def init_environment_variables(model: Type[Model]) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
9
9
  """
10
10
  A decorator for AWS Lambda handler functions. It initializes and validates environment variables based on the provided Pydantic model before the execution of the decorated function.
11
- It uses LRU Cache by model class type to optimize parsing time. Cache can be disabled by setting the environment variable 'LAMBDA_ENV_MODELER_DISABLE_CACHE' to FALSE (default: cache is enabled)
11
+ It uses LRU Cache by model class type to optimize parsing time. Cache can be disabled by setting the environment variable 'LAMBDA_ENV_MODELER_DISABLE_CACHE' to TRUE (default: cache is enabled)
12
12
 
13
13
  Args:
14
14
  model (Type[Model]): A Pydantic model that outlines the structure and types of the expected environment variables.
@@ -35,7 +35,7 @@ def init_environment_variables(model: Type[Model]) -> Callable[[Callable[..., An
35
35
  def get_environment_variables(model: Type[Model]) -> Model:
36
36
  """
37
37
  Retrieves and validates environment variables based on the provided Pydantic model.
38
- It uses LRU Cache by model class type to optimize parsing time. Cache can be disabled by setting the environment variable 'LAMBDA_ENV_MODELER_DISABLE_CACHE' to FALSE (default: cache is enabled)
38
+ It uses LRU Cache by model class type to optimize parsing time. Cache can be disabled by setting the environment variable 'LAMBDA_ENV_MODELER_DISABLE_CACHE' to TRUE (default: cache is enabled)
39
39
  It's recommended to use anywhere in the function's after init_environment_variables decorator was used on the handler function.
40
40
 
41
41
  Args:
@@ -4,10 +4,10 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "aws_lambda_env_modeler"
7
- version = "2.1.0"
7
+ version = "4.0.0"
8
8
  description = "AWS-Lambda-Env-Modeler is a Python library designed to simplify the process of managing and validating environment variables in your AWS Lambda functions."
9
9
  authors = [{ name = "Ran Isenberg" }]
10
- requires-python = ">=3.9.0,<4"
10
+ requires-python = ">=3.11.0,<4"
11
11
  readme = "README.md"
12
12
  license = "MIT-0"
13
13
  keywords = [
@@ -22,12 +22,11 @@ classifiers = [
22
22
  "Intended Audience :: Developers",
23
23
  "License :: OSI Approved :: MIT License",
24
24
  "Natural Language :: English",
25
- "Programming Language :: Python :: 3.9",
26
- "Programming Language :: Python :: 3.10",
27
25
  "Programming Language :: Python :: 3.11",
28
26
  "Programming Language :: Python :: 3.12",
29
27
  "Programming Language :: Python :: 3.13",
30
28
  "Programming Language :: Python :: 3.14",
29
+ "Programming Language :: Python :: 3.15",
31
30
  ]
32
31
  dependencies = ["pydantic>=2.12.0,<3"]
33
32
 
@@ -50,8 +49,7 @@ dev = [
50
49
  "xenon",
51
50
  "pre-commit",
52
51
  "ruff",
53
- "mkdocs-material",
54
- "mkdocs-git-revision-date-plugin",
52
+ "zensical",
55
53
  "types-cachetools",
56
54
  "mypy",
57
55
  "types-requests",
@@ -102,8 +100,8 @@ exclude = [
102
100
  line-length = 150
103
101
  indent-width = 4
104
102
 
105
- # Assume Python 3.14
106
- target-version = "py314"
103
+ # Minimum supported Python version
104
+ target-version = "py311"
107
105
 
108
106
  [tool.ruff.lint]
109
107
  # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
@@ -118,6 +116,8 @@ select = [
118
116
  ignore = [ "E203", "E266", "E501", "W191"]
119
117
 
120
118
  [tool.ruff.format]
119
+ # Markdown code blocks hold pymdownx snippet directives that are not valid Python
120
+ exclude = ["docs/*.md"]
121
121
  quote-style = "single"
122
122
 
123
123
  # Like Black, indent with spaces, rather than tabs.