Skip to content

Commit

Permalink
Merge from aws/aws-sam-cli/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sam-cli-bot authored Nov 21, 2024
2 parents 91956e9 + 909e5be commit 193b21f
Show file tree
Hide file tree
Showing 31 changed files with 681 additions and 663 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
ruby-version: "3.3"
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
Expand Down
31 changes: 16 additions & 15 deletions DEVELOPMENT_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ 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.7 and 3.8.
So having a Python environment with aforementioned versions is required.
AWS SAM CLI is mainly written in Python 3 and we support Python 3.8 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"
by other python packages. Here we introduce two ways of setting up a Python virtual environment:
Expand Down Expand Up @@ -163,26 +163,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 3.7 and 3.8 versions. Our CI/CD pipeline is setup to run
We support version 3.8 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).
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.

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 `samcli38`)
(assuming you are in virtual environment named `samcli39` with Python version 3.9.x)

```sh
# Your shell now should looks like "(samcli38) $"
pyenv deactivate samcli38 # "(samcli38)" will disappear
pyenv install 3.7.10 # one time setup
pyenv virtualenv 3.7.10 samcli37 # one time setup
pyenv activate samcli37
# Your shell now should looks like "(samcli37) $"
# 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) $"

# You can verify the version of Python
python --version # Python 3.7.10
python --version # Python 3.8.9

make init # one time setup, this will put a file `samdev` available in $PATH
```
Expand Down Expand Up @@ -255,9 +256,9 @@ 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.7 will work in Python3.8. You only run into problems if you are
trying to use features released in a higher version (for example features introduced into Python3.8
will not work in Python3.7). If you want to test in many versions, you can create a virtualenv for
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
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
16 changes: 2 additions & 14 deletions appveyor-windows-al2023.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,8 @@ install:
# Make sure the temp directory exists for Python to use.
- ps: "mkdir -Force C:\\tmp"
- "python --version"
# Temporarily install python3.13 from the embedded zip file. Once AppVeyor installs it in the image, the below code can be removed.
- ps: 'Invoke-WebRequest -Uri https://www.python.org/ftp/python/3.13.0/python-3.13.0-embed-amd64.zip -OutFile python313.zip'
- ps: "Expand-Archive -Path python313.zip -DestinationPath C:\\Python313-x64"
- 'set PATH=%PYTHON_HOME%;C:\Ruby33-x64\bin;C:\Ruby32-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python311-x64;C:\Python312-x64;C:\Python313-x64;C:\Python313-x64\Scripts;'
- ps: |
$pth_file = "C:\Python313-x64\python313._pth"
(Get-Content -Path $pth_file) -replace '#import site', 'import site' | Set-Content -Path $pth_file
- ps: |
if (!(Test-Path -Path "C:\Python313-x64\Scripts\pip.exe")) {
Invoke-WebRequest -Uri https://bootstrap.pypa.io/get-pip.py -OutFile get-pip.py
& "C:\Python313-x64\python.exe" get-pip.py
}
- "python --version"
- ps: pip --version
- 'set PATH=%PYTHON_HOME%;C:\Ruby33-x64\bin;C:\Ruby32-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python311-x64;C:\Python312-x64;C:\Python313-x64'
- "node --version"
- "echo %PYTHON_HOME%"
- "echo %PATH%"
- "python --version"
Expand Down
6 changes: 3 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ jmespath~=1.0.1
ruamel_yaml~=0.18.6
PyYAML~=6.0
cookiecutter~=2.6.0
aws-sam-translator==1.92.0
aws-sam-translator==1.93.0
#docker minor version updates can include breaking changes. Auto update micro version only.
docker~=7.1.0
dateparser~=1.2
requests~=2.32.3
aws_lambda_builders==1.51.0
aws_lambda_builders==1.52.0
tomlkit==0.13.2
# NOTE: For supporting watchdog in Python3.8, version is pinned to 4.0.2 as
# version 5.0.2 introduced some breaking changes for versions > Python3.8
Expand All @@ -34,4 +34,4 @@ tzlocal==5.2
cfn-lint~=1.19.0

# Type checking boto3 objects
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.35.56
boto3-stubs[apigateway,cloudformation,ecr,iam,lambda,s3,schemas,secretsmanager,signer,stepfunctions,sts,xray,sqs,kinesis]==1.35.63
9 changes: 5 additions & 4 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
-r pre-dev.txt

coverage==7.6.4; python_version>="3.9"
coverage==7.6.7; python_version>="3.9"
coverage==7.6.1; python_version<"3.9"
pytest-cov==5.0.0
pytest-cov==6.0.0; python_version>="3.9"
pytest-cov==5.0.0; python_version<"3.9"


# type checking and related stubs
# mypy adds new rules in new minor versions, which could cause our PR check to fail
# here we fix its version and upgrade it manually in the future
mypy==1.11.2
mypy==1.13.0
types-pywin32==308.0.0.20241029
types-PyYAML==6.0.12.20240917
types-chevron==0.14.2.20240310
types-psutil==6.1.0.20241102
types-setuptools==75.3.0.20241107
types-setuptools==75.5.0.20241116
types-Pygments==2.18.0.20240506
types-colorama==0.4.15.20240311
types-dateparser==1.2.0.20240420
Expand Down
2 changes: 1 addition & 1 deletion requirements/pre-dev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruff==0.7.2
ruff==0.7.4
2 changes: 1 addition & 1 deletion requirements/pyinstaller-build.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Executable binary builder requirements
setuptools==75.3.0
pyinstaller==6.11.0
pyinstaller==6.11.1
Loading

0 comments on commit 193b21f

Please sign in to comment.