Skip to content

Commit 221e6e4

Browse files
authoredOct 17, 2024
Merge from aws/aws-sam-cli/develop
2 parents 9c33647 + c280116 commit 221e6e4

14 files changed

+518
-509
lines changed
 

‎.github/workflows/validate_pyinstaller.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ jobs:
4848
- uses: actions/checkout@v4
4949
- uses: actions/setup-python@v5
5050
with:
51-
python-version: "3.8"
51+
python-version: "3.11"
5252
- name: Build PyInstaller
5353
run: |
5454
chmod +x ./installer/pyinstaller/build-mac.sh
5555
./installer/pyinstaller/build-mac.sh aws-sam-cli-macos-x86_64.zip
5656
- name: Basic tests for PyInstaller
5757
env:
58-
SAM_INIT_RUNTIME: "python3.8"
58+
SAM_INIT_RUNTIME: "python3.11"
5959
run: |
6060
unzip .build/output/aws-sam-cli-macos-x86_64.zip -d sam-installation
6161
sudo ./sam-installation/install

‎requirements/base.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ dateparser~=1.2
1313
requests~=2.32.3
1414
aws_lambda_builders==1.50.0
1515
tomlkit==0.13.2
16-
watchdog==4.0.2
17-
rich~=13.8.1
16+
watchdog==5.0.3; python_version>"3.8"
17+
watchdog==4.0.2; python_version<="3.8"
18+
19+
rich~=13.9.2
1820
pyopenssl~=24.2.1
1921
# Pin to <4.18 to until SAM-T no longer uses RefResolver
2022
jsonschema<4.24
@@ -28,7 +30,7 @@ regex!=2021.10.8
2830
tzlocal==5.2
2931

3032
#Adding cfn-lint dependency for SAM validate
31-
cfn-lint~=1.14.2
33+
cfn-lint~=1.16.0
3234

3335
# Type checking boto3 objects
34-
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.35.23
36+
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.35.32

‎requirements/dev.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ types-setuptools==75.1.0.20240917
1616
types-Pygments==2.18.0.20240506
1717
types-colorama==0.4.15.20240311
1818
types-dateparser==1.2.0.20240420
19-
types-docutils==0.21.0.20240907
19+
types-docutils==0.21.0.20241005
2020
types-jsonschema==4.23.0.20240813
2121
types-pyOpenSSL==24.1.0.20240722
2222
# lucashuy: pin `types-request` based on the Python version since newer versions of
@@ -38,7 +38,7 @@ pytest-rerunfailures==14.0
3838
pytest-metadata==3.1.1
3939
# NOTE (lucashuy): `pytest-json-report` was updated to `pytest-json-report-wip` as the original repository does not seem to be maintained anymore, if `-wip` is updated, validate the changes
4040
pytest-json-report-wip==1.5.1
41-
filelock==3.16.0
41+
filelock==3.16.1
4242

4343
# formatter
4444
black==24.8.0

‎requirements/pre-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruff==0.6.6
1+
ruff==0.6.9

‎requirements/reproducible-linux.txt

+166-171
Large diffs are not rendered by default.

‎requirements/reproducible-mac.txt

+136-136
Large diffs are not rendered by default.

‎requirements/reproducible-win.txt

+188-189
Large diffs are not rendered by default.

‎samcli/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
SAM CLI version
33
"""
44

5-
__version__ = "1.125.0"
5+
__version__ = "1.126.0"

‎samcli/lib/sync/watch_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def on_code_change(event: Optional[FileSystemEvent] = None) -> None:
363363
#
364364
# It looks like the other way a folder modified event can happen
365365
# is if the permissions of the folder were changed
366-
LOG.debug(f"Ignoring file system MODIFIED event for folder {event.src_path}")
366+
LOG.debug(f"Ignoring file system MODIFIED event for folder {event.src_path!r}")
367367
return
368368

369369
# sync flow factory should always exist, but guarding just incase

‎samcli/lib/utils/file_observer.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -455,14 +455,15 @@ def on_change(self, event: FileSystemEvent) -> None:
455455

456456
LOG.debug("a %s change got detected in path %s", event.event_type, event.src_path)
457457
for group, _observed_paths in self._observed_paths_per_group.items():
458+
observed_paths = None
458459
if event.event_type == EVENT_TYPE_DELETED:
459460
observed_paths = [
460461
path
461462
for path in _observed_paths
462463
if path == event.src_path
463-
or path in self._watch_dog_observed_paths.get(f"{event.src_path}_False", [])
464+
or path in self._watch_dog_observed_paths.get(f"{event.src_path!r}_False", [])
464465
]
465-
else:
466+
elif isinstance(event.src_path, str):
466467
observed_paths = [path for path in _observed_paths if event.src_path.startswith(path)]
467468

468469
if not observed_paths:

‎samcli/local/lambdafn/env_vars.py

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def _get_aws_variables(self):
176176
"AWS_ACCESS_KEY_ID": self.aws_creds.get("key", self._DEFAULT_AWS_CREDS["key"]),
177177
"AWS_SECRET_ACCESS_KEY": self.aws_creds.get("secret", self._DEFAULT_AWS_CREDS["secret"]),
178178
"AWS_ACCOUNT_ID": "123456789012",
179+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
179180
}
180181

181182
# Session Token should be added **only** if the input creds have a token and the value is not empty.
256 KB
Binary file not shown.
232 KB
Binary file not shown.

‎tests/unit/local/lambdafn/test_env_vars.py

+11
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def test_with_no_additional_variables(self):
122122
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
123123
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
124124
"AWS_ACCOUNT_ID": "123456789012",
125+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
125126
"AWS_REGION": "some region",
126127
"AWS_DEFAULT_REGION": "some region",
127128
"AWS_ACCESS_KEY_ID": "some key",
@@ -151,6 +152,7 @@ def test_with_only_default_values_for_variables(self):
151152
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
152153
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
153154
"AWS_ACCOUNT_ID": "123456789012",
155+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
154156
"AWS_REGION": "us-east-1",
155157
"AWS_ACCESS_KEY_ID": "defaultkey",
156158
"AWS_SECRET_ACCESS_KEY": "defaultsecret",
@@ -184,6 +186,7 @@ def test_with_shell_env_value(self):
184186
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
185187
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
186188
"AWS_ACCOUNT_ID": "123456789012",
189+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
187190
"AWS_REGION": "us-east-1",
188191
"AWS_ACCESS_KEY_ID": "defaultkey",
189192
"AWS_SECRET_ACCESS_KEY": "defaultsecret",
@@ -225,6 +228,7 @@ def test_with_overrides_value(self):
225228
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
226229
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
227230
"AWS_ACCOUNT_ID": "123456789012",
231+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
228232
"AWS_REGION": "us-east-1",
229233
"AWS_ACCESS_KEY_ID": "defaultkey",
230234
"AWS_SECRET_ACCESS_KEY": "defaultsecret",
@@ -282,6 +286,7 @@ def test_must_work_with_overridden_aws_creds(self):
282286
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
283287
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
284288
"AWS_ACCOUNT_ID": "123456789012",
289+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
285290
"AWS_SESSION_TOKEN": "some other token",
286291
}
287292

@@ -300,6 +305,7 @@ def test_must_work_without_any_aws_creds(self):
300305
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
301306
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
302307
"AWS_ACCOUNT_ID": "123456789012",
308+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
303309
# Default values assigned to these variables
304310
"AWS_REGION": "us-east-1",
305311
"AWS_DEFAULT_REGION": "us-east-1",
@@ -323,6 +329,7 @@ def test_must_work_with_partial_aws_creds(self):
323329
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
324330
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
325331
"AWS_ACCOUNT_ID": "123456789012",
332+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
326333
# Values from the input creds
327334
"AWS_REGION": "some other region",
328335
"AWS_DEFAULT_REGION": "some other region",
@@ -346,6 +353,7 @@ def test_must_work_with_text_logformat(self):
346353
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
347354
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
348355
"AWS_ACCOUNT_ID": "123456789012",
356+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
349357
# Default values assigned to these variables
350358
"AWS_REGION": "us-east-1",
351359
"AWS_DEFAULT_REGION": "us-east-1",
@@ -369,6 +377,7 @@ def test_must_work_with_default_json_logging_config(self):
369377
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
370378
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
371379
"AWS_ACCOUNT_ID": "123456789012",
380+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
372381
# Default values assigned to these variables
373382
"AWS_REGION": "us-east-1",
374383
"AWS_DEFAULT_REGION": "us-east-1",
@@ -393,6 +402,7 @@ def test_must_work_with_set_application_log_level(self):
393402
"AWS_LAMBDA_LOG_GROUP_NAME": f"aws/lambda/{self.name}",
394403
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
395404
"AWS_ACCOUNT_ID": "123456789012",
405+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
396406
# Default values assigned to these variables
397407
"AWS_REGION": "us-east-1",
398408
"AWS_DEFAULT_REGION": "us-east-1",
@@ -417,6 +427,7 @@ def test_must_work_with_custom_log_group_name(self):
417427
"AWS_LAMBDA_LOG_GROUP_NAME": "myCustomLogGroup",
418428
"AWS_LAMBDA_LOG_STREAM_NAME": "$LATEST",
419429
"AWS_ACCOUNT_ID": "123456789012",
430+
"AWS_LAMBDA_INITIALIZATION_TYPE": "on-demand",
420431
# Default values assigned to these variables
421432
"AWS_REGION": "us-east-1",
422433
"AWS_DEFAULT_REGION": "us-east-1",

0 commit comments

Comments
 (0)
Failed to load comments.