Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions DEVELOPMENT_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gitpod is free for 50 hours per month - make sure to stop your workspace when yo
## Environment Setup
### 1. Prerequisites (Python Virtual Environment)

AWS SAM CLI is mainly written in Python 3 and we support Python 3.8 and above.
AWS SAM CLI is mainly written in Python 3 and we support Python 3.10 and above.
So, having a Python environment with this version is required.

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

```sh
# Assuming you want to develop AWS SAM CLI in Python 3.8.9
pyenv install 3.8.9 # install Python 3.8.9 using pyenv
pyenv virtualenv 3.8.9 samcli38 # create a virtual environment using 3.8.9 named "samcli38"
pyenv activate samcli38 # activate the virtual environment
# Assuming you want to develop AWS SAM CLI in Python 3.12
pyenv install 3.12 # install Python 3.12 using pyenv
pyenv virtualenv 3.12 samcli312 # create a virtual environment using 3.12 named "samcli312"
pyenv activate samcli312 # activate the virtual environment
```

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

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

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

We support version 3.8 and above. Our CI/CD pipeline is setup to run
We support version 3.10 and above. Our CI/CD pipeline is setup to run
unit tests against all Python versions. So make sure you test it
with all versions before sending a Pull Request.
See [Unit testing with multiple Python versions](#unit-testing-with-multiple-python-versions-optional).
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.
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 3.11+ will not work.

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

(assuming you are in virtual environment named `samcli39` with Python version 3.9.x)
(assuming you are in virtual environment named `samcli312` with Python version 3.12.x)

```sh
# Your shell now should look like "(samcli39) $"
pyenv deactivate samcli39 # "(samcli39)" will disappear
pyenv install 3.8.9 # one time setup
pyenv virtualenv 3.8.9 samcli38 # one time setup
pyenv activate samcli38
# Your shell now should look like "(samcli38) $"
# Your shell now should look like "(samcli312) $"
pyenv deactivate samcli312 # "(samcli312)" will disappear
pyenv install 3.10 # one time setup
pyenv virtualenv 3.10 samcli310 # one time setup
pyenv activate samcli310
# Your shell now should look like "(samcli310) $"

# You can verify the version of Python
python --version # Python 3.8.9
python --version # Python 3.10.x

make init # one time setup, this will put a file `samdev` available in $PATH
```
Expand Down Expand Up @@ -235,11 +235,11 @@ and this will happen:
pyenv: black: command not found

The `black' command exists in these Python versions:
3.8.9/envs/samcli38
samcli38
3.12/envs/samcli312
samcli312
```

A simple workaround is to use `/Users/<username>/.pyenv/versions/samcli37/bin/black`
A simple workaround is to use `/Users/<username>/.pyenv/versions/samcli312/bin/black`
instead of `/Users/<username>/.pyenv/shims/black`.

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

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

Currently, SAM CLI only supports Python3 versions (see setup.py for exact versions). For the most
part, code that works in Python3.8 will work in Python3.9. You only run into problems if you are
trying to use features released in a higher version (for example features introduced into Python3.9
will not work in Python3.8). If you want to test in many versions, you can create a virtualenv for
Currently, SAM CLI only supports Python3 versions (see pyproject.toml for exact versions). For the most
part, code that works in Python3.10 will work in Python3.11. You only run into problems if you are
trying to use features released in a higher version (for example features introduced into Python3.11
will not work in Python3.10). If you want to test in many versions, you can create a virtualenv for
each version and flip between them (sourcing the activate script). Typically, we run all tests in
one python version locally and then have our ci (appveyor) run all supported versions.

Expand Down
2 changes: 1 addition & 1 deletion samcli/commands/build/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
2. Nodejs 24.x, 22.x, 20.x, 18.x, 16.x, 14.x, 12.x using NPM\n
3. Ruby 3.2, 3.3, 3.4 using Bundler\n
4. Java 8, Java 11, Java 17, Java 21, Java 25 using Gradle and Maven\n
5. Dotnet6, Dotnet8, Dotnet10 using Dotnet CLI\n
5. Dotnet8, Dotnet10 using Dotnet CLI\n
6. Go 1.x using Go Modules (without --use-container)\n
"""

Expand Down
1 change: 1 addition & 0 deletions samcli/lib/build/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
"python3.7",
"ruby2.5",
"ruby2.7",
"dotnet6",
}
BUILD_PROPERTIES = "BuildProperties"
2 changes: 0 additions & 2 deletions samcli/lib/build/workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def get_layer_subfolder(build_workflow: str) -> str:
"java17": "java",
"java21": "java",
"java25": "java",
"dotnet6": "dotnet",
"dotnet8": "dotnet",
"dotnet10": "dotnet",
# User is responsible for creating subfolder in these workflows
Expand Down Expand Up @@ -175,7 +174,6 @@ def get_workflow_config(
"ruby3.2": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
"ruby3.3": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
"ruby3.4": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
"dotnet6": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
"dotnet8": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
"dotnet10": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
"go1.x": BasicWorkflowSelector(GO_MOD_CONFIG),
Expand Down
12 changes: 11 additions & 1 deletion samcli/lib/init/local_manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"dotnet6": [
"dotnet10": [
{
"directory": "template/cookiecutter-aws-sam-hello-dotnet",
"displayName": "Hello World Example",
"dependencyManager": "cli-package",
"appTemplate": "hello-world",
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
],
"dotnet8": [
{
"directory": "template/cookiecutter-aws-sam-hello-dotnet",
"displayName": "Hello World Example",
Expand Down
1 change: 0 additions & 1 deletion samcli/lib/utils/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"java21": [ARM64, X86_64],
"java25": [ARM64, X86_64],
"go1.x": [X86_64],
"dotnet6": [ARM64, X86_64],
"dotnet8": [ARM64, X86_64],
"dotnet10": [ARM64, X86_64],
"provided": [X86_64],
Expand Down
5 changes: 1 addition & 4 deletions samcli/local/common/runtime_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
],
"dotnet": [
{
"runtimes": ["dotnet10", "dotnet8", "dotnet6"],
"runtimes": ["dotnet10", "dotnet8"],
"dependency_manager": "cli-package",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-dotnet"),
"build": True,
Expand Down Expand Up @@ -109,7 +109,6 @@ def get_local_lambda_images_location(mapping, runtime):
# dotnet runtimes in descending order
"dotnet10",
"dotnet8",
"dotnet6",
# go runtimes in descending order
"go1.x",
# java runtimes in descending order
Expand Down Expand Up @@ -146,7 +145,6 @@ def get_local_lambda_images_location(mapping, runtime):
LAMBDA_IMAGES_RUNTIMES_MAP = {
"dotnet10": "amazon/dotnet10-base",
"dotnet8": "amazon/dotnet8-base",
"dotnet6": "amazon/dotnet6-base",
"go1.x": "amazon/go1.x-base",
"go (provided.al2)": "amazon/go-provided.al2-base",
"go (provided.al2023)": "amazon/go-provided.al2023-base",
Expand Down Expand Up @@ -190,7 +188,6 @@ def get_local_lambda_images_location(mapping, runtime):
"python3.12": "Python36",
"python3.13": "Python36",
"python3.14": "Python36",
"dotnet6": "dotnet6",
"dotnet8": "dotnet6",
"dotnet10": "dotnet6",
"go1.x": "Go1",
Expand Down
Loading
Loading