Skip to content

Commit fbe90ce

Browse files
feat(sam): python 3.10 support for SAM, lambda #3269
previous (python 3.9): 08bf494 Signed-off-by: Nikolas Komonen <[email protected]>
1 parent 439d74e commit fbe90ce

File tree

8 files changed

+44
-5
lines changed

8 files changed

+44
-5
lines changed

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)
92+
- Python (3.7, 3.8, 3.9, 3.10)
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', 'go1.x'].includes(runtime)
57+
return ['python3.7', 'python3.8', 'python3.9', 'python3.10', 'go1.x'].includes(runtime)
5858
}
5959

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

src/integrationTest/sam.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ const scenarios: TestScenario[] = [
112112
// language: 'python',
113113
// dependencyManager: 'pip',
114114
// },
115+
{
116+
runtime: 'python3.10',
117+
displayName: 'python 3.10 (ZIP)',
118+
path: 'hello_world/app.py',
119+
debugSessionType: 'python',
120+
language: 'python',
121+
dependencyManager: 'pip',
122+
vscodeMinimum: '1.65.0',
123+
},
115124
{
116125
runtime: 'java8',
117126
displayName: 'java8 (Gradle ZIP)',
@@ -212,6 +221,16 @@ const scenarios: TestScenario[] = [
212221
// language: 'python',
213222
// dependencyManager: 'pip',
214223
// },
224+
{
225+
runtime: 'python3.10',
226+
displayName: 'python 3.10 (ZIP)',
227+
baseImage: 'amazon/python3.10-base',
228+
path: 'hello_world/app.py',
229+
debugSessionType: 'python',
230+
language: 'python',
231+
dependencyManager: 'pip',
232+
vscodeMinimum: '1.65.0',
233+
},
215234
{
216235
runtime: 'go1.x',
217236
displayName: 'go1.x (Image)',
@@ -536,7 +555,10 @@ describe('SAM Integration Tests', async function () {
536555
})
537556

538557
it('target=api: invokes and attaches on debug request (F5)', async function () {
539-
if (skipLanguagesOnApi.includes(scenario.language)) {
558+
if (
559+
skipLanguagesOnApi.includes(scenario.language) ||
560+
semver.lt(vscode.version, scenario.vscodeMinimum)
561+
) {
540562
this.skip()
541563
}
542564

@@ -551,6 +573,10 @@ describe('SAM Integration Tests', async function () {
551573
})
552574

553575
it('target=template: invokes and attaches on debug request (F5)', async function () {
576+
if (semver.lt(vscode.version, scenario.vscodeMinimum)) {
577+
this.skip()
578+
}
579+
554580
setTestTimeout(this.test?.fullTitle(), debugTimeout)
555581
await testTarget('template')
556582
})

src/lambda/models/samLambdaRuntime.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ export const nodeJsRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>([
3333
'nodejs14.x',
3434
'nodejs12.x',
3535
])
36-
export const pythonRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>(['python3.9', 'python3.8', 'python3.7'])
36+
export const pythonRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>([
37+
'python3.10',
38+
'python3.9',
39+
'python3.8',
40+
'python3.7',
41+
])
3742
export const goRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>(['go1.x'])
3843
export const javaRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>(['java11', 'java8', 'java8.al2'])
3944
export const dotNetRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>(['dotnetcore3.1', 'dotnet6'])

src/shared/sam/debugger/pythonSamDebug.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ function getPythonExeAndBootstrap(runtime: Runtime) {
256256
return { python: '/var/lang/bin/python3.8', bootstrap: '/var/runtime/bootstrap.py' }
257257
case 'python3.9':
258258
return { python: '/var/lang/bin/python3.9', bootstrap: '/var/runtime/bootstrap.py' }
259+
case 'python3.10':
260+
return { python: '/var/lang/bin/python3.10', bootstrap: '/var/runtime/bootstrap.py' }
259261
default:
260262
throw new Error(`Python SAM debug logic ran for invalid Python runtime: ${runtime}`)
261263
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ describe('getApiValueForSchemasDownload', function () {
2929
switch (runtime) {
3030
case 'python3.7':
3131
case 'python3.8':
32-
case 'python3.9': {
32+
case 'python3.9':
33+
case 'python3.10': {
3334
const result = getApiValueForSchemasDownload(runtime)
3435
assert.strictEqual(result, 'Python36', 'Api value used by schemas api')
3536
break

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ describe('runtimes', function () {
7171
'nodejs14.x',
7272
'nodejs16.x',
7373
'nodejs18.x',
74+
'python3.10',
7475
'python3.7',
7576
'python3.8',
7677
'python3.9',
@@ -80,6 +81,7 @@ describe('runtimes', function () {
8081
'nodejs14.x',
8182
'nodejs16.x',
8283
'nodejs18.x',
84+
'python3.10',
8385
'python3.7',
8486
'python3.8',
8587
'python3.9',
@@ -97,6 +99,7 @@ describe('runtimes', function () {
9799
'nodejs14.x',
98100
'nodejs16.x',
99101
'nodejs18.x',
102+
'python3.10',
100103
'python3.7',
101104
'python3.8',
102105
'python3.9',
@@ -113,6 +116,7 @@ describe('runtimes', function () {
113116
'nodejs14.x',
114117
'nodejs16.x',
115118
'nodejs18.x',
119+
'python3.10',
116120
'python3.7',
117121
'python3.8',
118122
'python3.9',

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

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

0 commit comments

Comments
 (0)