You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVELOPMENT_GUIDE.md
+29-29Lines changed: 29 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Gitpod is free for 50 hours per month - make sure to stop your workspace when yo
20
20
## Environment Setup
21
21
### 1. Prerequisites (Python Virtual Environment)
22
22
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.
24
24
So, having a Python environment with this version is required.
25
25
26
26
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
64
64
Next, setup a virtual environment and activate it:
65
65
66
66
```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
71
71
```
72
72
73
73
### 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
142
142
```sh
143
143
source<sam-cli-directory-path>/.venv/bin/activate # if you chose to use venv to setup the virtual environment
144
144
# 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
146
146
```
147
147
148
148
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.
173
173
174
174
### Make Sure AWS SAM CLI Work in Multiple Python Versions
175
175
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.
179
179
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.
181
181
182
182
If you chose to use `pyenv` in the previous session, setting up a
183
183
different Python version should be easy:
184
184
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)
186
186
187
187
```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) $"
194
194
195
195
# You can verify the version of Python
196
-
python --version # Python 3.8.9
196
+
python --version # Python 3.10.19
197
197
198
198
make init # one time setup, this will put a file `samdev` available in $PATH
199
199
```
@@ -202,8 +202,8 @@ For Windows, use your favorite tool for managing different python versions and e
202
202
203
203
### Format Python Code
204
204
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.
207
207
208
208
There are generally 3 options to make sure your change is compliant with our formatting standard:
209
209
@@ -235,11 +235,11 @@ and this will happen:
235
235
pyenv: black: command not found
236
236
237
237
The `black' command exists in these Python versions:
238
-
3.8.9/envs/samcli38
239
-
samcli38
238
+
3.10.19/envs/samcli310
239
+
samcli310
240
240
```
241
241
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`
243
243
instead of `/Users/<username>/.pyenv/shims/black`.
244
244
245
245
#### (Option 3) Pre-commit
@@ -265,12 +265,12 @@ We also suggest to run `make pr` or `./Make -pr` in all Python versions.
265
265
266
266
#### Unit Testing with Multiple Python Versions (Optional)
267
267
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.
0 commit comments