Skip to content

Commit 999d51f

Browse files
authored
docs: align contributor Python version docs with package metadata (#9047)
* docs: align contributor Python version guidance * docs: fix stale virtualenv example in dev guide
1 parent 58da8ea commit 999d51f

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

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

0 commit comments

Comments
 (0)