chore: drop Python 3.9 support for running SAM, add Python 3.12-3.14 to CI#3893
chore: drop Python 3.9 support for running SAM, add Python 3.12-3.14 to CI#3893roger-zhangg wants to merge 5 commits intoaws:developfrom
Conversation
Drop Python 3.9 as a supported version for running SAM CLI/translator itself. This does NOT affect Python 3.9 as a Lambda runtime — SAM templates using python3.9 as a Lambda runtime continue to work as before. Changes: - setup.py: bump python_requires to >=3.10, update classifiers to 3.10-3.14 - .github/workflows/build.yml: test matrix now runs 3.10, 3.11, 3.12, 3.13, 3.14 - pyproject.toml: black target_version updated to py310-py314 - ruff.toml, tests/ruff.toml, integration/ruff.toml: target-version bumped to py310 - requirements/base.txt: simplified pydantic pin (removed 3.8/3.9 conditionals) - DEVELOPMENT_GUIDE.md: updated supported versions and pyenv instructions
| # checking policy action | ||
| actions = dlq_policy_statement["Action"] | ||
| action_list = actions if isinstance(actions, list) == list else [actions] | ||
| action_list = actions if actions is list else [actions] |
There was a problem hiding this comment.
I don't think this is correct.
type(actions) is list would work, but actions is list will never be True (and it's not the same that we had before).
This is probably why you had to add an exception for this in the ruff.toml file, but ruff complaining about this usage of is is exactly what we want on this line
There was a problem hiding this comment.
wait, I'm reading this code again. The previous code was very weird too!
isinstance(actions, list) == list will always be false too. Because isinstance returns a boolean!
Probably that's why this new code is so weird too. I guess we never go in the if and apparently the test works well in that case. (because it's waiting only one element in the next line).
Let's still fix this, but at least I see that the implementation had problems before
| "**/*.py" = [ | ||
| "S101", # Use of `assert` detected | ||
| "PLR", # pylint-refactor | ||
| "E721", # Use `is` and `is not` for type comparisons |
There was a problem hiding this comment.
I added another comment mentioning that we might not want to add this (at least another part when there's actually an error that should have been caught by this). Are there other parts that are failing with this rule?
What
Drop Python 3.9 as a supported version for running the SAM translator itself, and extend CI coverage to Python 3.12, 3.13, and 3.14.
Important distinction
This change only drops Python 3.9 as a version for running SAM. Python 3.9 as a Lambda runtime in SAM templates is still fully supported. Test fixtures that use
Runtime: python3.9are intentionally left unchanged.Changes
python_requiresbumped to>=3.10, classifiers updated to 3.10–3.14target_versionupdated to py310–py314target-versionbumped topy310