aws-lambda-env-modeler 3.0.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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: aws_lambda_env_modeler
3
- Version: 3.0.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,20 +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.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
19
18
  Classifier: Programming Language :: Python :: 3.13
20
19
  Classifier: Programming Language :: Python :: 3.14
21
- Requires-Python: <4,>=3.10.0
20
+ Classifier: Programming Language :: Python :: 3.15
21
+ Requires-Python: <4,>=3.11.0
22
22
  Requires-Dist: pydantic<3,>=2.12.0
23
23
  Description-Content-Type: text/markdown
24
24
 
25
25
 
26
26
  # AWS Lambda Environment Variables Modeler (Python)
27
27
 
28
- [![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)
29
- ![PythonSupport](https://img.shields.io/static/v1?label=python&message=%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)
30
30
  ![PyPI version](https://badge.fury.io/py/aws-lambda-env-modeler.svg)
31
31
  ![PyPi monthly downloads](https://img.shields.io/pypi/dm/aws-lambda-env-modeler)
32
32
  [![PyPI Downloads](https://static.pepy.tech/badge/aws-lambda-env-modeler)](https://pepy.tech/projects/aws-lambda-env-modeler)
@@ -35,7 +35,7 @@ Description-Content-Type: text/markdown
35
35
  ![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ran-isenberg/aws-lambda-env-modeler/badge)
36
36
  ![issues](https://img.shields.io/github/issues/ran-isenberg/aws-lambda-env-modeler)
37
37
 
38
- ![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>
39
39
 
40
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.
41
41
 
@@ -43,7 +43,7 @@ It leverages the power of [Pydantic](https://docs.pydantic.dev/latest/) models t
43
43
 
44
44
  This library is especially handy for serverless applications where managing configuration via environment variables is a common practice.
45
45
 
46
- **[📜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)**
47
47
  > **Contact details | ran.isenberg@ranthebuilder.cloud**
48
48
 
49
49
 
@@ -60,12 +60,12 @@ This usage may cause nasty bugs or even crashes in production.
60
60
 
61
61
  This library allows you to correctly parse, validate, and use your environment variables in your Python AWS Lambda code.
62
62
 
63
- 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).
64
64
 
65
65
  ### **Features**
66
66
 
67
67
  - Validates the environment variables against a Pydantic model: define both semantic and syntactic validation.
68
- - Serializes the string environment variables into complex classes and types.
68
+ - Parses the string environment variables into complex classes and types.
69
69
  - Provides means to access the environment variables safely with a global getter function in every part of the function.
70
70
  - Provides a decorator to initialize the environment variables before executing a function.
71
71
  - Caches the parsed model for performance improvement for multiple 'get' calls.
@@ -73,14 +73,22 @@ Read more about it [here](https://www.ranthebuilder.cloud/post/aws-lambda-cookbo
73
73
 
74
74
  ## Installation
75
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
+
76
78
  You can install it using pip:
77
79
 
78
80
  ```bash
79
81
  pip install aws-lambda-env-modeler
80
82
  ```
81
83
 
84
+ or uv:
85
+
86
+ ```bash
87
+ uv add aws-lambda-env-modeler
88
+ ```
89
+
82
90
  ## Getting started
83
- 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/)
84
92
 
85
93
 
86
94
  ## Usage
@@ -89,12 +97,13 @@ First, define a Pydantic model for your environment variables:
89
97
  ```python
90
98
  from pydantic import BaseModel, HttpUrl
91
99
 
100
+
92
101
  class MyEnvVariables(BaseModel):
93
102
  DB_HOST: str
94
103
  DB_PORT: int
95
104
  DB_USER: str
96
105
  DB_PASS: str
97
- FLAG_X: bool
106
+ FLAG_X: bool
98
107
  API_URL: HttpUrl
99
108
  ```
100
109
 
@@ -102,18 +111,17 @@ Before executing a function, you must use the `@init_environment_variables` deco
102
111
 
103
112
  The decorator guarantees that the function will run with the correct variable configuration.
104
113
 
105
- 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.
106
-
107
114
  ```python
108
115
  from aws_lambda_env_modeler import init_environment_variables
109
116
 
117
+
110
118
  @init_environment_variables(model=MyEnvVariables)
111
119
  def my_handler_entry_function(event, context):
112
120
  # At this point, environment variables are already validated and initialized
113
121
  pass
114
122
  ```
115
123
 
116
- 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.
117
125
 
118
126
  ```python
119
127
  from aws_lambda_env_modeler import get_environment_variables
@@ -126,20 +134,19 @@ print(env_vars.DB_HOST)
126
134
 
127
135
  By default, the modeler uses cache - the parsed model is cached for performance improvement for multiple 'get' calls.
128
136
 
129
- 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`.
130
138
 
131
- 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.
132
140
 
133
141
  Here's an example of how you can use this in a pytest test:
134
142
 
135
143
  ```python
136
144
  import json
137
145
  from http import HTTPStatus
138
- from typing import Any, Dict
146
+ from typing import Any, Dict, Literal
139
147
  from unittest.mock import patch
140
148
 
141
149
  from pydantic import BaseModel
142
- from typing import Literal
143
150
 
144
151
  from aws_lambda_env_modeler import LAMBDA_ENV_MODELER_DISABLE_CACHE, get_environment_variables, init_environment_variables
145
152
 
@@ -175,7 +182,7 @@ Read our code of conduct [here.](https://github.com/ran-isenberg/aws-lambda-env-
175
182
 
176
183
  ## Connect
177
184
  * Email: [ran.isenberg@ranthebuilder.cloud](mailto:ran.isenberg@ranthebuilder.cloud)
178
- * Blog Website [RanTheBuilder](https://www.ranthebuilder.cloud)
185
+ * Website [RanTheBuilder](https://www.ranthebuilder.cloud)
179
186
  * LinkedIn: [ranisenberg](https://www.linkedin.com/in/ranisenberg/)
180
187
  * Twitter: [RanBuilder](https://twitter.com/RanBuilder)
181
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.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,7 +11,7 @@
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
 
@@ -19,7 +19,7 @@ It leverages the power of [Pydantic](https://docs.pydantic.dev/latest/) models t
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,18 +87,17 @@ 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
 
93
+
86
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
@@ -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 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 = "3.0.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.10.0,<4"
10
+ requires-python = ">=3.11.0,<4"
11
11
  readme = "README.md"
12
12
  license = "MIT-0"
13
13
  keywords = [
@@ -22,11 +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.10",
26
25
  "Programming Language :: Python :: 3.11",
27
26
  "Programming Language :: Python :: 3.12",
28
27
  "Programming Language :: Python :: 3.13",
29
28
  "Programming Language :: Python :: 3.14",
29
+ "Programming Language :: Python :: 3.15",
30
30
  ]
31
31
  dependencies = ["pydantic>=2.12.0,<3"]
32
32
 
@@ -100,8 +100,8 @@ exclude = [
100
100
  line-length = 150
101
101
  indent-width = 4
102
102
 
103
- # Assume Python 3.14
104
- target-version = "py314"
103
+ # Minimum supported Python version
104
+ target-version = "py311"
105
105
 
106
106
  [tool.ruff.lint]
107
107
  # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
@@ -116,6 +116,8 @@ select = [
116
116
  ignore = [ "E203", "E266", "E501", "W191"]
117
117
 
118
118
  [tool.ruff.format]
119
+ # Markdown code blocks hold pymdownx snippet directives that are not valid Python
120
+ exclude = ["docs/*.md"]
119
121
  quote-style = "single"
120
122
 
121
123
  # Like Black, indent with spaces, rather than tabs.