Skip to content

Commit 7c5bca7

Browse files
authored
chore: Drop python3.7 support for SAM-T (#3403)
1 parent 4ff61a5 commit 7c5bca7

27 files changed

+39
-76
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
os:
2121
- ubuntu-latest
2222
python:
23-
- "3.7"
2423
- "3.8"
2524
- "3.9"
2625
- "3.10"

DEVELOPMENT_GUIDE.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Environment setup
2626
-----------------
2727
### 1. Install Python versions
2828

29-
Our officially supported Python versions are 3.7, 3.8, 3.9 and 3.10.
29+
Our officially supported Python versions are 3.8, 3.9 and 3.10.
3030
Our CI/CD pipeline is setup to run unit tests against Python 3 versions. Make sure you test it before sending a Pull Request.
3131
See [Unit testing with multiple Python versions](#unit-testing-with-multiple-python-versions).
3232

@@ -40,12 +40,11 @@ easily setup multiple Python versions. For
4040
1. Install PyEnv -
4141
`curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash`
4242
1. Restart shell so the path changes take effect - `exec $SHELL`
43-
1. `pyenv install 3.7.16`
4443
1. `pyenv install 3.8.16`
4544
1. `pyenv install 3.9.16`
4645
1. `pyenv install 3.10.9`
4746
3. Make Python versions available in the project:
48-
`pyenv local 3.7.16 3.8.16 3.9.16 3.10.9`
47+
`pyenv local 3.8.16 3.9.16 3.10.9`
4948

5049
Note: also make sure the following lines were written into your `.bashrc` (or `.zshrc`, depending on which shell you are using):
5150
```
@@ -66,7 +65,7 @@ can be found [here](https://black.readthedocs.io/en/stable/editor_integration.ht
6665
Since black is installed in virtualenv, when you follow [this instruction](https://black.readthedocs.io/en/stable/editor_integration.html), `which black` might give you this
6766

6867
```bash
69-
(sam37) $ where black
68+
(sam38) $ where black
7069
/Users/<username>/.pyenv/shims/black
7170
```
7271

@@ -77,11 +76,11 @@ and this will happen:
7776
pyenv: black: command not found
7877
7978
The `black' command exists in these Python versions:
80-
3.7.9/envs/sam37
81-
sam37
79+
3.8.16/envs/sam38
80+
sam38
8281
```
8382

84-
A simple workaround is to use `/Users/<username>/.pyenv/versions/sam37/bin/black`
83+
A simple workaround is to use `/Users/<username>/.pyenv/versions/sam38/bin/black`
8584
instead of `/Users/<username>/.pyenv/shims/black`.
8685

8786
#### Pre-commit
@@ -99,15 +98,15 @@ handy plugin that can create virtualenv.
9998
Depending on the python version, the following commands would change to
10099
be the appropriate python version.
101100

102-
1. Create Virtualenv `sam37` for Python3.7: `pyenv virtualenv 3.7.9 sam37`
103-
1. Activate Virtualenv: `pyenv activate sam37`
101+
1. Create Virtualenv `sam38` for Python3.8: `pyenv virtualenv 3.8.16 sam38`
102+
1. Activate Virtualenv: `pyenv activate sam38`
104103

105104
### 4. Install dev version of SAM transform
106105

107106
We will install a development version of SAM transform from source into the
108107
virtualenv.
109108

110-
1. Activate Virtualenv: `pyenv activate sam37`
109+
1. Activate Virtualenv: `pyenv activate sam38`
111110
1. Install dev version of SAM transform: `make init`
112111

113112
Running tests
@@ -121,8 +120,8 @@ Run `make test` or `make test-fast`. Once all tests pass make sure to run
121120

122121
### Unit testing with multiple Python versions
123122

124-
Currently, our officially supported Python versions are 3.7, 3.8, 3.9 and 3.10. For the most
125-
part, code that works in Python3.7 will work in Pythons 3.8, 3.9 and 3.10. You only run into problems if you are
123+
Currently, our officially supported Python versions are 3.8, 3.9 and 3.10. For the most
124+
part, code that works in Python3.8 will work in Pythons 3.9 and 3.10. You only run into problems if you are
126125
trying to use features released in a higher version (for example features introduced into Python3.10
127126
will not work in Python3.9). If you want to test in many versions, you can create a virtualenv for
128127
each version and flip between them (sourcing the activate script). Typically, we run all tests in

HOWTO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Check out the [latest specification](versions/2016-10-31.md) for details on how
2121
You could also use the [aws-sam-cli](https://github.com/awslabs/aws-sam-cli) to get started
2222

2323
```shell
24-
$ sam init --runtime python3.7
24+
$ sam init --runtime python3.8
2525
```
2626
## Packing Artifacts
2727
Before you can deploy a SAM template, you should first upload your Lambda

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ For a more thorough introduction, see the [this tutorial](https://docs.aws.amazo
8585
8686
### Setting up development environment
8787
88-
You'll need to have Python 3.7+ installed.
88+
You'll need to have Python 3.8+ installed.
8989
9090
Create a [virtual environment](https://docs.python.org/3/library/venv.html):
9191

bin/transform-test-error-json-format.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
import sys
99
from pathlib import Path
1010

11-
from typing_extensions import Final
12-
1311
# To allow this script to be executed from other directories
1412
sys.path.insert(0, str(Path(__file__).absolute().parent.parent))
1513

1614
import json
17-
from typing import Type
15+
from typing import Final, Type
1816

1917
from bin._file_formatter import FileFormatter
2018

integration/helpers/deployer/utils/colors.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Wrapper to generated colored messages for printing in Terminal
33
This was ported over from the sam-cli repo
44
"""
5-
from typing import Dict
6-
7-
from typing_extensions import Literal
5+
from typing import Dict, Literal
86

97
SupportedColor = Literal["red", "green", "yellow"]
108

integration/ruff.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ select = [
1515
"UP", # pyupgrade
1616
]
1717

18-
# Mininal python version we support is 3.7
19-
target-version = "py37"
18+
# Mininal python version we support is 3.8
19+
target-version = "py38"
2020

2121
[per-file-ignores]
2222

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.black]
22
line-length = 120
3-
target_version = ['py37', 'py38', 'py39', 'py310']
3+
target_version = ['py38', 'py39', 'py310']
44
exclude = '''
55
66
(

pytest.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ filterwarnings =
1414
# From our own tests
1515
ignore:__init__ is deprecated and will be removed in a future release:DeprecationWarning
1616
ignore:deprecated_function is deprecated and will be removed in a future release, please use replacement_function:DeprecationWarning
17-
# Python 3.7 deprecation
18-
ignore::boto3.exceptions.PythonDeprecationWarning
1917
# https://github.com/pytest-dev/pytest-xdist/issues/825#issuecomment-1292450429
2018
ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning
2119
# Pytest warnings

requirements/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
boto3>=1.19.5,==1.*
22
jsonschema<5,>=3.2 # TODO: evaluate risk of removing jsonschema 3.x support
3-
typing_extensions>=4.4,<5 # 3.7 doesn't have Literal
3+
typing_extensions>=4.4 # 3.8 doesn't have Required, TypeGuard and ParamSpec
44

55
# resource validation & schema generation
66
pydantic>=1.8,<3

requirements/dev.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tenacity~=8.0
1919
requests~=2.28
2020

2121
# formatter
22-
black==23.3.0 # 23.3.0 is the last version supporting python 3.7
22+
black==23.10.1
2323
ruamel.yaml==0.17.21 # It can parse yaml while perserving comments
2424

2525
# type check
@@ -29,7 +29,3 @@ mypy~=1.3.0
2929
boto3-stubs[appconfig,serverlessrepo]>=1.19.5,==1.*
3030
types-PyYAML~=6.0
3131
types-jsonschema~=3.2
32-
33-
# Check package version (backport importlib.metadata for python 3.7)
34-
# https://docs.python.org/3/library/importlib.metadata.html
35-
importlib_metadata; python_version < '3.8'

ruff.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ ignore = [
3737
"G004",
3838
]
3939

40-
# Mininal python version we support is 3.7
41-
target-version = "py37"
40+
# Mininal python version we support is 3.8
41+
target-version = "py38"
4242

4343
[per-file-ignores]
4444
# python scripts in bin/ needs some python path configurations before import

samtranslator/internal/model/appsync.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from typing import Any, Dict, List, Optional, Union
1+
from typing import Any, Dict, List, Optional, TypedDict, Union
22

3-
from typing_extensions import Required, TypedDict
3+
from typing_extensions import Required
44

55
from samtranslator.model import GeneratedProperty, Resource
66
from samtranslator.model.intrinsics import fnGetAtt, ref

samtranslator/internal/schema_source/aws_serverless_api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Dict, List, Optional, Union
4-
5-
from typing_extensions import Literal
3+
from typing import Dict, List, Literal, Optional, Union
64

75
from samtranslator.internal.schema_source.aws_serverless_connector import EmbeddedConnector
86
from samtranslator.internal.schema_source.common import (

samtranslator/internal/schema_source/aws_serverless_application.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, Dict, Optional, Union
4-
5-
from typing_extensions import Literal
3+
from typing import Any, Dict, Literal, Optional, Union
64

75
from samtranslator.internal.schema_source.common import (
86
BaseModel,

samtranslator/internal/schema_source/aws_serverless_connector.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from typing import List, Optional, Union
2-
3-
from typing_extensions import Literal
1+
from typing import List, Literal, Optional, Union
42

53
from samtranslator.internal.schema_source.common import (
64
BaseModel,

samtranslator/internal/schema_source/aws_serverless_function.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Dict, List, Optional, Union
4-
5-
from typing_extensions import Literal
3+
from typing import Dict, List, Literal, Optional, Union
64

75
from samtranslator.internal.schema_source.aws_serverless_connector import EmbeddedConnector
86
from samtranslator.internal.schema_source.common import (

samtranslator/internal/schema_source/aws_serverless_graphqlapi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from typing import Dict, List, Optional, Union
2-
3-
from typing_extensions import Literal
1+
from typing import Dict, List, Literal, Optional, Union
42

53
from samtranslator.internal.schema_source.common import (
64
BaseModel,

samtranslator/internal/schema_source/aws_serverless_httpapi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Dict, List, Optional, Union
4-
5-
from typing_extensions import Literal
3+
from typing import Dict, List, Literal, Optional, Union
64

75
from samtranslator.internal.schema_source.aws_serverless_connector import EmbeddedConnector
86
from samtranslator.internal.schema_source.common import (

samtranslator/internal/schema_source/aws_serverless_layerversion.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Optional, Union
4-
5-
from typing_extensions import Literal
3+
from typing import Literal, Optional, Union
64

75
from samtranslator.internal.schema_source.common import (
86
BaseModel,

samtranslator/internal/schema_source/aws_serverless_simpletable.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, Dict, Optional
4-
5-
from typing_extensions import Literal
3+
from typing import Any, Dict, Literal, Optional
64

75
from samtranslator.internal.schema_source.aws_serverless_connector import EmbeddedConnector
86
from samtranslator.internal.schema_source.common import (

samtranslator/internal/schema_source/aws_serverless_statemachine.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Dict, List, Optional, Union
4-
5-
from typing_extensions import Literal
3+
from typing import Dict, List, Literal, Optional, Union
64

75
from samtranslator.internal.schema_source.aws_serverless_connector import EmbeddedConnector
86
from samtranslator.internal.schema_source.common import (

samtranslator/internal/schema_source/common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import json
22
from functools import partial
33
from pathlib import Path
4-
from typing import Any, Dict, List, Optional, TypeVar, Union
5-
6-
from typing_extensions import Literal
4+
from typing import Any, Dict, List, Literal, Optional, TypeVar, Union
75

86
from samtranslator.compat import pydantic
97
from samtranslator.model.types import PassThrough

samtranslator/metrics/metrics.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
import logging
55
from abc import ABC, abstractmethod
66
from datetime import datetime
7-
from typing import Any, Dict, List, Optional, Union
8-
9-
from typing_extensions import TypedDict
7+
from typing import Any, Dict, List, Optional, TypedDict, Union
108

119
from samtranslator.internal.deprecation_control import deprecated
1210

samtranslator/model/sam_resources.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
""" SAM macro definitions """
22
import copy
33
from contextlib import suppress
4-
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast
5-
6-
from typing_extensions import Literal
4+
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, cast
75

86
import samtranslator.model.eventsources
97
import samtranslator.model.eventsources.cloudwatchlogs

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def read_requirements(req="base.txt"):
7878
"NOTICE",
7979
"THIRD_PARTY_LICENSES",
8080
),
81-
python_requires=">=3.7, <=4.0, !=4.0",
81+
python_requires=">=3.8, <=4.0, !=4.0",
8282
install_requires=read_requirements("base.txt"),
8383
include_package_data=True,
8484
extras_require={"dev": read_requirements("dev.txt")},
@@ -93,7 +93,6 @@ def read_requirements(req="base.txt"):
9393
"License :: OSI Approved :: Apache Software License",
9494
"Operating System :: OS Independent",
9595
"Programming Language :: Python",
96-
"Programming Language :: Python :: 3.7",
9796
"Programming Language :: Python :: 3.8",
9897
"Programming Language :: Python :: 3.9",
9998
"Programming Language :: Python :: 3.10",

tests/ruff.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ select = [
1515
"UP", # pyupgrade
1616
]
1717

18-
# Mininal python version we support is 3.7
19-
target-version = "py37"
18+
# Mininal python version we support is 3.8
19+
target-version = "py38"
2020

2121
[per-file-ignores]
2222

0 commit comments

Comments
 (0)