Skip to content

Commit ca5a310

Browse files
committed
fix: resolve merge conflict with upstream develop
2 parents 8d1a612 + 999d51f commit ca5a310

87 files changed

Lines changed: 2282 additions & 630 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ jobs:
197197
run: pytest -vv ${{ matrix.tests_config.params }}
198198
env:
199199
FORCE_RUN_DOCKER_TEST: ${{ matrix.tests_config.name == 'durable-functions' && '1' || '' }}
200+
DURABLE_EXECUTIONS_EMULATOR_IMAGE_TAG: ${{ matrix.tests_config.name == 'durable-functions' && 'v1.1.1' || '' }}
200201

201202
smoke-and-functional-tests:
202203
name: ${{ matrix.tests_config.name }} / ${{ matrix.tests_config.os }} / ${{ matrix.python }}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Contributions via pull requests are much appreciated. Before sending us a pull r
4343
1. You are working against the latest source on the *develop* branch.
4444
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
4545
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
46-
4. The change works in Python3 (see supported Python Versions in setup.py)
46+
4. The change works in supported Python versions (see `pyproject.toml` and CI workflows)
4747
5. Does the PR have updated/added unit, functional, and integration tests?
4848
6. PR is merged submitted to merge into develop.
4949

DEVELOPMENT_GUIDE.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gitpod is free for 50 hours per month - make sure to stop your workspace when yo
2020
## Environment Setup
2121
### 1. Prerequisites (Python Virtual Environment)
2222

23-
AWS SAM CLI is mainly written in Python 3 and we support Python 3.8 and above.
23+
AWS SAM CLI is mainly written in Python 3 and currently requires Python 3.10 and above.
2424
So, having a Python environment with this version is required.
2525

2626
Having a dedicated Python virtual environment ensures it won't "pollute" or get "polluted"
@@ -64,10 +64,10 @@ exec $SHELL # restart your shell to enable pyenv-virtualenv
6464
Next, setup a virtual environment and activate it:
6565

6666
```sh
67-
# Assuming you want to develop AWS SAM CLI in Python 3.8.9
68-
pyenv install 3.8.9 # install Python 3.8.9 using pyenv
69-
pyenv virtualenv 3.8.9 samcli38 # create a virtual environment using 3.8.9 named "samcli38"
70-
pyenv activate samcli38 # activate the virtual environment
67+
# Assuming you want to develop AWS SAM CLI in Python 3.10.19
68+
pyenv install 3.10.19 # install Python 3.10.19 using pyenv
69+
pyenv virtualenv 3.10.19 samcli310 # create a virtual environment using 3.10.19 named "samcli310"
70+
pyenv activate samcli310 # activate the virtual environment
7171
```
7272

7373
### 2. Initialize dependencies and create `samdev` available in `$PATH`
@@ -142,7 +142,7 @@ Make sure you are in the same virtual environment as the one you are using with
142142
```sh
143143
source <sam-cli-directory-path>/.venv/bin/activate # if you chose to use venv to setup the virtual environment
144144
# or
145-
pyenv activate samcli38 # if you chose to use pyenv to setup the virtual environment
145+
pyenv activate samcli310 # if you chose to use pyenv to setup the virtual environment
146146
```
147147

148148
Install the SAM Transformer in editable mode so that
@@ -173,27 +173,27 @@ contribute to the repository, there are a few more things to consider.
173173

174174
### Make Sure AWS SAM CLI Work in Multiple Python Versions
175175

176-
We support version 3.8 and above. Our CI/CD pipeline is setup to run
177-
unit tests against all Python versions. So make sure you test it
178-
with all versions before sending a Pull Request.
176+
We support version 3.10 and above. Our PR workflow runs on Python 3.10 and 3.11,
177+
and our integration workflows install additional Python versions to cover Lambda runtime scenarios.
178+
So make sure you test your change against supported Python versions before sending a Pull Request.
179179
See [Unit testing with multiple Python versions](#unit-testing-with-multiple-python-versions-optional).
180-
This is most important if you are developing in a Python version greater than the minimum supported version (currently 3.8), as any new features released in 3.9+ will not work.
180+
This is most important if you are developing in a Python version greater than the minimum supported version (currently 3.10), as any new features released in higher versions will not work on the minimum supported version.
181181

182182
If you chose to use `pyenv` in the previous session, setting up a
183183
different Python version should be easy:
184184

185-
(assuming you are in virtual environment named `samcli39` with Python version 3.9.x)
185+
(assuming you are in virtual environment named `samcli311` with Python version 3.11.x)
186186

187187
```sh
188-
# Your shell now should look like "(samcli39) $"
189-
pyenv deactivate samcli39 # "(samcli39)" will disappear
190-
pyenv install 3.8.9 # one time setup
191-
pyenv virtualenv 3.8.9 samcli38 # one time setup
192-
pyenv activate samcli38
193-
# Your shell now should look like "(samcli38) $"
188+
# Your shell now should look like "(samcli311) $"
189+
pyenv deactivate samcli311 # "(samcli311)" will disappear
190+
pyenv install 3.10.19 # one time setup
191+
pyenv virtualenv 3.10.19 samcli310 # one time setup
192+
pyenv activate samcli310
193+
# Your shell now should look like "(samcli310) $"
194194

195195
# You can verify the version of Python
196-
python --version # Python 3.8.9
196+
python --version # Python 3.10.19
197197

198198
make init # one time setup, this will put a file `samdev` available in $PATH
199199
```
@@ -202,8 +202,8 @@ For Windows, use your favorite tool for managing different python versions and e
202202

203203
### Format Python Code
204204

205-
We format our code using [Black](https://github.com/python/black) and verify the source code is
206-
black compliant in AppVeyor during PRs. Black will be installed automatically with `make init` or `./Make -Init` on Windows.
205+
We format our code using [Black](https://github.com/python/black) and verify the source code in GitHub Actions during PRs.
206+
Black will be installed automatically with `make init` or `./Make -Init` on Windows.
207207

208208
There are generally 3 options to make sure your change is compliant with our formatting standard:
209209

@@ -235,11 +235,11 @@ and this will happen:
235235
pyenv: black: command not found
236236
237237
The `black' command exists in these Python versions:
238-
3.8.9/envs/samcli38
239-
samcli38
238+
3.10.19/envs/samcli310
239+
samcli310
240240
```
241241

242-
A simple workaround is to use `/Users/<username>/.pyenv/versions/samcli37/bin/black`
242+
A simple workaround is to use `/Users/<username>/.pyenv/versions/samcli310/bin/black`
243243
instead of `/Users/<username>/.pyenv/shims/black`.
244244

245245
#### (Option 3) Pre-commit
@@ -265,12 +265,12 @@ We also suggest to run `make pr` or `./Make -pr` in all Python versions.
265265

266266
#### Unit Testing with Multiple Python Versions (Optional)
267267

268-
Currently, SAM CLI only supports Python3 versions (see setup.py for exact versions). For the most
269-
part, code that works in Python3.8 will work in Python3.9. You only run into problems if you are
270-
trying to use features released in a higher version (for example features introduced into Python3.9
271-
will not work in Python3.8). If you want to test in many versions, you can create a virtualenv for
272-
each version and flip between them (sourcing the activate script). Typically, we run all tests in
273-
one python version locally and then have our ci (appveyor) run all supported versions.
268+
Currently, SAM CLI supports Python 3.10 and above (see `pyproject.toml` for package metadata and
269+
`.github/workflows/build.yml` for the PR test matrix). For the most part, code that works in Python 3.10
270+
will work in Python 3.11. You only run into problems if you are trying to use features released in a
271+
higher version that do not exist in the minimum supported version. If you want to test in many versions,
272+
you can create a virtualenv for each version and flip between them (sourcing the activate script).
273+
Typically, we run tests in one Python version locally and let CI cover the supported matrix.
274274

275275
#### Integration Test (Optional)
276276

docs/cfn-language-extensions.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,73 @@ SAM CLI now supports templates that use the `AWS::LanguageExtensions` transform,
44

55
## How it works
66

7-
When SAM CLI detects `AWS::LanguageExtensions` in a template's `Transform` section, it expands language extension constructs locally before running SAM transforms. This enables `sam build`, `sam package`, `sam deploy`, `sam sync`, `sam validate`, `sam local invoke`, and `sam local start-api` to work with templates that use these constructs.
7+
When SAM CLI detects `AWS::LanguageExtensions` in a template's `Transform` section *and* the customer has opted in to local processing, it expands language extension constructs locally before running SAM transforms. This enables `sam build`, `sam package`, `sam deploy`, `sam sync`, `sam validate`, `sam local invoke`, `sam local start-api`, and `sam local start-lambda` to work with templates that use these constructs.
88

9-
The expansion happens in two phases:
9+
**Local processing is off by default.** When off, SAM CLI passes the template through unchanged; CloudFormation processes the `AWS::LanguageExtensions` transform server-side at deploy time (the pre-1.160.0 behavior).
10+
11+
The expansion happens in two phases when enabled:
1012

1113
1. **Phase 1 (Language Extensions)**`Fn::ForEach` loops are expanded, intrinsic functions are resolved where possible, and the template is converted to standard CloudFormation.
1214
2. **Phase 2 (SAM Transform)** — The expanded template is processed by the SAM Translator as usual.
1315

1416
The original template (with `Fn::ForEach` intact) is preserved for CloudFormation deployment, since CloudFormation processes the `AWS::LanguageExtensions` transform server-side.
1517

18+
## Enabling Language Extensions
19+
20+
Local processing of `AWS::LanguageExtensions` is opt-in per command. Three activation methods, in priority order (highest first):
21+
22+
1. **CLI flag** — pass `--language-extensions` on a single invocation:
23+
24+
```bash
25+
sam build --language-extensions
26+
sam package --language-extensions ...
27+
sam deploy --language-extensions ...
28+
```
29+
30+
`--no-language-extensions` explicitly disables, overriding both samconfig.toml and the env var below.
31+
32+
2. **`samconfig.toml`** — persist the choice per project:
33+
34+
```toml
35+
[default.build.parameters]
36+
language_extensions = true
37+
38+
[default.package.parameters]
39+
language_extensions = true
40+
41+
[default.deploy.parameters]
42+
language_extensions = true
43+
44+
[default.sync.parameters]
45+
language_extensions = true
46+
47+
[default.local_invoke.parameters]
48+
language_extensions = true
49+
50+
[default.local_start_api.parameters]
51+
language_extensions = true
52+
53+
[default.local_start_lambda.parameters]
54+
language_extensions = true
55+
56+
[default.validate.parameters]
57+
language_extensions = true
58+
```
59+
60+
A `samconfig.toml` entry is loaded into Click's defaults, so it takes effect as if the flag were passed — and therefore wins over the env var.
61+
62+
3. **Environment variable** — set `SAM_CLI_ENABLE_LANGUAGE_EXTENSIONS=1` to enable for the current shell:
63+
64+
```bash
65+
export SAM_CLI_ENABLE_LANGUAGE_EXTENSIONS=1
66+
sam build
67+
sam local invoke MyFunction
68+
```
69+
70+
Truthy values (case-insensitive): `1`, `true`, `yes`. Anything else, including empty string, is off. The env var is consulted only when neither the CLI flag nor samconfig.toml sets a value.
71+
72+
**Each command needs its own activation.** Passing `--language-extensions` to `sam build` does not propagate to a later `sam local invoke` — local processing is decided per command invocation. Use the env var or samconfig entry to enable across commands without repeating the flag.
73+
1674
## Fn::ForEach
1775

1876
`Fn::ForEach` generates multiple resources, conditions, or outputs from a single template definition:
@@ -286,4 +344,4 @@ The following template issues are caught locally before the SAM transform runs:
286344

287345
## Telemetry
288346

289-
SAM CLI tracks usage of `AWS::LanguageExtensions` via the `CFNLanguageExtensions` telemetry feature flag. No template content is transmitted.
347+
SAM CLI emits a `CFNLanguageExtensions` telemetry event when a command is invoked with `--language-extensions` (or its env-var equivalent) **and** the template declares the `AWS::LanguageExtensions` transform. The event fires once per invocation; no template content is transmitted. When local processing is off (the default), no event fires.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies = [
4040
"ruamel_yaml~=0.19.1",
4141
"PyYAML~=6.0",
4242
"cookiecutter>=2.6,<2.8",
43-
"aws-sam-translator==1.109.0",
43+
"aws-sam-translator==1.110.0",
4444
# docker minor version updates can include breaking changes. Auto update micro version only.
4545
"docker~=7.1.0",
4646
"dateparser~=1.3",

0 commit comments

Comments
 (0)