Skip to content

Remove python 3.8 support #7908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
2 changes: 0 additions & 2 deletions samcli/lib/build/workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def get_selector(

def get_layer_subfolder(build_workflow: str) -> str:
subfolders_by_runtime = {
"python3.8": "python",
"python3.9": "python",
"python3.10": "python",
"python3.11": "python",
Expand Down Expand Up @@ -155,7 +154,6 @@ def get_workflow_config(
}

selectors_by_runtime = {
"python3.8": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.9": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.10": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
"python3.11": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
Expand Down
10 changes: 0 additions & 10 deletions samcli/lib/init/local_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,5 @@
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
],
"python3.8": [
{
"directory": "template/cookiecutter-aws-sam-hello-python",
"displayName": "Hello World Example",
"dependencyManager": "pip",
"appTemplate": "hello-world",
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"project_name": "Name of the project",
"runtime": "python3.8",
"runtime": "python3.9",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be good to update this to a newer version of python right away (python3.13), because this is the default init template if people have problems downloading the full list of templates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks

"architectures": {
"value": [
"x86_64"
Expand Down
1 change: 0 additions & 1 deletion samcli/lib/utils/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"nodejs18.x": [ARM64, X86_64],
"nodejs20.x": [ARM64, X86_64],
"nodejs22.x": [ARM64, X86_64],
"python3.8": [ARM64, X86_64],
"python3.9": [ARM64, X86_64],
"python3.10": [ARM64, X86_64],
"python3.11": [ARM64, X86_64],
Expand Down
5 changes: 1 addition & 4 deletions samcli/local/common/runtime_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
RUNTIME_DEP_TEMPLATE_MAPPING = {
"python": [
{
"runtimes": ["python3.13", "python3.12", "python3.11", "python3.10", "python3.9", "python3.8"],
"runtimes": ["python3.13", "python3.12", "python3.11", "python3.10", "python3.9"],
"dependency_manager": "pip",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-python"),
"build": True,
Expand Down Expand Up @@ -123,7 +123,6 @@ def get_local_lambda_images_location(mapping, runtime):
"python3.11",
"python3.10",
"python3.9",
"python3.8",
# ruby runtimes in descending order
"ruby3.3",
"ruby3.2",
Expand All @@ -149,7 +148,6 @@ def get_local_lambda_images_location(mapping, runtime):
"python3.11": "amazon/python3.11-base",
"python3.10": "amazon/python3.10-base",
"python3.9": "amazon/python3.9-base",
"python3.8": "amazon/python3.8-base",
"ruby3.3": "amazon/ruby3.3-base",
"ruby3.2": "amazon/ruby3.2-base",
}
Expand All @@ -164,7 +162,6 @@ def get_local_lambda_images_location(mapping, runtime):
"java11": "Java8",
"java17": "Java8",
"java21": "Java8",
"python3.8": "Python36",
"python3.9": "Python36",
"python3.10": "Python36",
"python3.11": "Python36",
Expand Down
4 changes: 0 additions & 4 deletions samcli/local/docker/lambda_debug_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
**_container_env_vars,
},
),
Runtime.python38.value: lambda: DebugSettings(
entry + ["/var/lang/bin/python3.8"] + debug_args_list + ["/var/runtime/bootstrap.py"],
container_env_vars=_container_env_vars,
),
Runtime.python39.value: lambda: DebugSettings(
entry + ["/var/lang/bin/python3.9"] + debug_args_list + ["/var/runtime/bootstrap.py"],
container_env_vars=_container_env_vars,
Expand Down
1 change: 0 additions & 1 deletion samcli/local/docker/lambda_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Runtime(Enum):
nodejs18x = "nodejs18.x"
nodejs20x = "nodejs20.x"
nodejs22x = "nodejs22.x"
python38 = "python3.8"
python39 = "python3.9"
python310 = "python3.10"
python311 = "python3.11"
Expand Down
13 changes: 5 additions & 8 deletions schema/samcli.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Resources:
Properties:
CodeUri: s3://bucket/key
Handler: app.lambda_handler
Runtime: python3.8
Runtime: python3.9
Role:
Fn::GetAtt:
- HelloWorldFunctionRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Resources:
Properties:
CodeUri: s3://bucket/key
Handler: code/handler
Runtime: python3.8
Runtime: python3.9
Events:
AllEvent:
Type: Api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.8
Runtime: python3.9
InlineCode: foo
Handler: bar
Events:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Resources:
Properties:
CodeUri: s3://sam-demo-bucket/queues.zip
Handler: handlers.handler
Runtime: python3.8
Runtime: python3.9
Events:
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ Resources:
Properties:
CodeUri: s3://sam-demo-bucket/hello.zip
Handler: hello.handler
Runtime: python3.8
Runtime: python3.9
RuntimeManagementConfig:
UpdateRuntimeOn: Auto
MinimalFunctionWithManualRuntimeManagementConfig:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/hello.zip
Handler: hello.handler
Runtime: python3.8
Runtime: python3.9
RuntimeManagementConfig:
UpdateRuntimeOn: Manual
RuntimeVersionArn: !Sub arn:aws:lambda:${AWS::Region}::runtime:python3.8::0af1966588ced06e3143ae720245c9b7aeaae213c6921c12c742a166679cc505
RuntimeVersionArn: !Sub arn:aws:lambda:${AWS::Region}::runtime:python3.9::0af1966588ced06e3143ae720245c9b7aeaae213c6921c12c742a166679cc505
FunctionWithRuntimeManagementConfigAndAlias:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/hello.zip
Handler: hello.handler
Runtime: python3.8
Runtime: python3.9
AutoPublishAlias: live
RuntimeManagementConfig:
UpdateRuntimeOn: Auto
Expand All @@ -38,15 +38,15 @@ Resources:
Properties:
CodeUri: s3://sam-demo-bucket/hello.zip
Handler: hello.handler
Runtime: python3.8
Runtime: python3.9
RuntimeManagementConfig:
UpdateRuntimeOn: !Ref RuntimeUpdateParam
FunctionWithIntrinsicRuntimeVersion:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://sam-demo-bucket/hello.zip
Handler: hello.handler
Runtime: python3.8
Runtime: python3.9
RuntimeManagementConfig:
UpdateRuntimeOn: !Ref RuntimeUpdateParam
RuntimeVersionArn: !Ref RuntimeVersionParam
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Resources:
pass"
CodeUri: .
Handler: index.lambda_handler
Runtime: python3.8
Runtime: python3.9
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.8
Runtime: python3.9
Handler: foo
InlineCode: bar
Policies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Resources:
OtherFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.8
Runtime: python3.9
Handler: foo
InlineCode: bar
Environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Resources:
print(event)
return "do nothing"
Handler: index.handler
Runtime: python3.8
Runtime: python3.9
Post:
Type: AWS::Serverless::StateMachine
Properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Resources:
Properties:
CodeUri: s3://sam-demo-bucket/resolver.zip
Handler: resolver.handler
Runtime: python3.8
Runtime: python3.9

NestedWorkflow:
Type: AWS::Serverless::StateMachine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"useCaseName": "Hello World Example"
}
],
"python3.8": [
"python3.9": [
{
"directory": "python3.8/cookiecutter-aws-sam-hello",
"directory": "python3.9/cookiecutter-aws-sam-hello",
"displayName": "Hello World Example",
"dependencyManager": "pip",
"appTemplate": "hello-world",
"packageType": "Zip",
"useCaseName": "Hello World Example"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Resources:
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Runtime: python3.8
Runtime: python3.9
{%- if cookiecutter.architectures.value != []%}
Architectures:
{%- for arch in cookiecutter.architectures.value %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import json

# import requests


def lambda_handler(event, context):
"""Sample pure Lambda function

Parameters
----------
event: dict, required
API Gateway Lambda Proxy Input Format

Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format

context: object, required
Lambda Context runtime methods and attributes

Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html

Returns
------
API Gateway Lambda Proxy Output Format: dict

Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
"""

# try:
# ip = requests.get("http://checkip.amazonaws.com/")
# except requests.RequestException as e:
# # Send some context about this error to Lambda Logs
# print(e)

# raise e

return {
"statusCode": 200,
"body": json.dumps(
{
"message": "hello world",
# "location": ip.text.replace("\n", "")
}
),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
{{ cookiecutter.project_name }}

Sample SAM Template for {{ cookiecutter.project_name }}

# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 3

Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Runtime: python3.9
{%- if cookiecutter.architectures.value != []%}
Architectures:
{%- for arch in cookiecutter.architectures.value %}
- {{arch}}
{%- endfor %}
{%- endif %}
Events:
HelloWorld:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /hello
Method: get

Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
HelloWorldApi:
Description: "API Gateway endpoint URL for Prod stage for Hello World function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
HelloWorldFunction:
Description: "Hello World Lambda Function ARN"
Value: !GetAtt HelloWorldFunction.Arn
HelloWorldFunctionIamRole:
Description: "Implicit IAM Role created for Hello World function"
Value: !GetAtt HelloWorldFunctionRole.Arn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The file was provided to confirm that all unsupported runtime were eliminated and only supported runtime was provided to the customer to select
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Resources:
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Runtime: python3.8
Runtime: python3.9
{%- if cookiecutter.architectures.value != []%}
Architectures:
{%- for arch in cookiecutter.architectures.value %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Resources:
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Runtime: python3.8
Runtime: python3.9
{%- if cookiecutter.architectures.value != []%}
Architectures:
{%- for arch in cookiecutter.architectures.value %}
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/buildcmd/test_build_cmd_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def _test_default_requirements_wrapper(self, runtime, dockerfile):

@parameterized.expand(
[
*[(runtime, "Dockerfile") for runtime in ["3.8", "3.9", "3.10", "3.11"]],
*[(runtime, "Dockerfile.production") for runtime in ["3.8", "3.9", "3.10", "3.11"]],
*[(runtime, "Dockerfile") for runtime in ["3.9", "3.10", "3.11"]],
*[(runtime, "Dockerfile.production") for runtime in ["3.9", "3.10", "3.11"]],
]
)
def test_with_default_requirements(self, runtime, dockerfile):
Expand Down Expand Up @@ -158,8 +158,8 @@ def _test_default_requirements_wrapper(self, runtime, dockerfile, expected):

@parameterized.expand(
[
*[(runtime, "feature_phi/Dockerfile", {"phi": "1.62"}) for runtime in ["3.8", "3.9", "3.10", "3.11"]],
*[(runtime, "feature_pi/Dockerfile", {"pi": "3.14"}) for runtime in ["3.8", "3.9", "3.10", "3.11"]],
*[(runtime, "feature_phi/Dockerfile", {"phi": "1.62"}) for runtime in ["3.9", "3.10", "3.11"]],
*[(runtime, "feature_pi/Dockerfile", {"pi": "3.14"}) for runtime in ["3.9", "3.10", "3.11"]],
]
)
def test_with_default_requirements(self, runtime, dockerfile, expected):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/deploy/test_managed_stack_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary
SKIP_MANAGED_STACK_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY
# Limits the managed stack tests to be run on a single python version to avoid CI race conditions
IS_TARGETTED_PYTHON_VERSION = PYTHON_VERSION.startswith("3.8")
IS_TARGETTED_PYTHON_VERSION = PYTHON_VERSION.startswith("3.9")

CFN_PYTHON_VERSION_SUFFIX = PYTHON_VERSION.replace(".", "-")
# Set region for managed stacks to be in a different region than the ones in deploy
Expand Down
Loading
Loading