Skip to content

Commit e3c16f2

Browse files
committed
feat(sam): python 3.11 support for SAM, lambda
previous: fbe90ce
1 parent efac481 commit e3c16f2

File tree

9 files changed

+36
-2
lines changed

9 files changed

+36
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "SAM: create, run and debug Python 3.11 Lambdas #3753"
4+
}

README.quickstart.cloud9.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ When you're satisfied with performance, you can [deploy your serverless applicat
8989
The Toolkit _local SAM debugging_ feature supports these runtimes:
9090

9191
- JavaScript (Node.js 12.x, 14.x)
92-
- Python (3.7, 3.8, 3.9, 3.10)
92+
- Python (3.7, 3.8, 3.9, 3.10, 3.11)
9393

9494
For more information see [Working with AWS Serverless Applications](https://docs.aws.amazon.com/cloud9/latest/user-guide/serverless-apps-toolkit.html) in the user guide.
9595

src/eventSchemas/models/schemaCodeLangs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function getLanguageDetails(language: SchemaCodeLangs): {
5454
}
5555

5656
export function supportsEventBridgeTemplates(runtime: Runtime): boolean {
57-
return ['python3.7', 'python3.8', 'python3.9', 'python3.10', 'go1.x'].includes(runtime)
57+
return ['python3.7', 'python3.8', 'python3.9', 'python3.10', 'python3.11', 'go1.x'].includes(runtime)
5858
}
5959

6060
export function getApiValueForSchemasDownload(runtime: Runtime): string {

src/lambda/models/samLambdaRuntime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function getNodeMajorVersion(version?: string): number | undefined {
4949
}
5050

5151
export const pythonRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>([
52+
'python3.11',
5253
'python3.10',
5354
'python3.9',
5455
'python3.8',

src/shared/sam/debugger/pythonSamDebug.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ function getPythonExeAndBootstrap(runtime: Runtime) {
258258
return { python: '/var/lang/bin/python3.9', bootstrap: '/var/runtime/bootstrap.py' }
259259
case 'python3.10':
260260
return { python: '/var/lang/bin/python3.10', bootstrap: '/var/runtime/bootstrap.py' }
261+
case 'python3.11':
262+
return { python: '/var/lang/bin/python3.11', bootstrap: '/var/runtime/bootstrap.py' }
261263
default:
262264
throw new Error(`Python SAM debug logic ran for invalid Python runtime: ${runtime}`)
263265
}

src/test/eventSchemas/model/schemaCodeLangs.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('getApiValueForSchemasDownload', function () {
3030
case 'python3.7':
3131
case 'python3.8':
3232
case 'python3.9':
33+
case 'python3.11':
3334
case 'python3.10': {
3435
const result = getApiValueForSchemasDownload(runtime)
3536
assert.strictEqual(result, 'Python36', 'Api value used by schemas api')

src/test/lambda/models/samLambdaRuntime.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ describe('runtimes', function () {
7474
'nodejs16.x',
7575
'nodejs18.x',
7676
'python3.10',
77+
'python3.11',
7778
'python3.7',
7879
'python3.8',
7980
'python3.9',
@@ -84,6 +85,7 @@ describe('runtimes', function () {
8485
'nodejs16.x',
8586
'nodejs18.x',
8687
'python3.10',
88+
'python3.11',
8789
'python3.7',
8890
'python3.8',
8991
'python3.9',
@@ -102,6 +104,7 @@ describe('runtimes', function () {
102104
'nodejs16.x',
103105
'nodejs18.x',
104106
'python3.10',
107+
'python3.11',
105108
'python3.7',
106109
'python3.8',
107110
'python3.9',
@@ -119,6 +122,7 @@ describe('runtimes', function () {
119122
'nodejs16.x',
120123
'nodejs18.x',
121124
'python3.10',
125+
'python3.11',
122126
'python3.7',
123127
'python3.8',
124128
'python3.9',

src/test/lambda/models/samTemplates.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ describe('getSamTemplateWizardOption', function () {
6767
case 'python3.8':
6868
case 'python3.9':
6969
case 'python3.10':
70+
case 'python3.11':
7071
assert.deepStrictEqual(
7172
result,
7273
validPythonTemplateOptions,

src/testInteg/sam.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ const scenarios: TestScenario[] = [
119119
// https://github.com/microsoft/vscode-python/blob/main/package.json
120120
vscodeMinimum: '1.78.0',
121121
},
122+
{
123+
runtime: 'python3.11',
124+
displayName: 'python 3.11 (ZIP)',
125+
path: 'hello_world/app.py',
126+
debugSessionType: 'python',
127+
language: 'python',
128+
dependencyManager: 'pip',
129+
// https://github.com/microsoft/vscode-python/blob/main/package.json
130+
vscodeMinimum: '1.78.0',
131+
},
122132
{
123133
runtime: 'java8',
124134
displayName: 'java8 (Gradle ZIP)',
@@ -230,6 +240,17 @@ const scenarios: TestScenario[] = [
230240
// https://github.com/microsoft/vscode-python/blob/main/package.json
231241
vscodeMinimum: '1.78.0',
232242
},
243+
{
244+
runtime: 'python3.11',
245+
displayName: 'python 3.11 (ZIP)',
246+
baseImage: 'amazon/python3.11-base',
247+
path: 'hello_world/app.py',
248+
debugSessionType: 'python',
249+
language: 'python',
250+
dependencyManager: 'pip',
251+
// https://github.com/microsoft/vscode-python/blob/main/package.json
252+
vscodeMinimum: '1.78.0',
253+
},
233254
// {
234255
// runtime: 'go1.x',
235256
// displayName: 'go1.x (Image)',

0 commit comments

Comments
 (0)