Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

chore(layer): add Python version in Layer description #108

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lambda-powertools-layer-python-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class LambdaPowertoolsLayerPythonV3 extends lambda.LayerVersion {
),
PYTHON_VERSION: pythonVersionNormalized,
},
// supports cross-platform docker build
// supports cross-platform docker build using different Python versions
platform: getDockerPlatformNameFromArchitectures(
compatibleArchitectures,
),
Expand All @@ -77,7 +77,7 @@ export class LambdaPowertoolsLayerPythonV3 extends lambda.LayerVersion {
license: 'MIT-0',
compatibleRuntimes: [props?.pythonVersion || Runtime.PYTHON_3_12],
description:
`Powertools for AWS Lambda (Python) V3 [${compatibleArchitecturesDescription}]${props?.includeExtras ? ' with extra dependencies' : ''
`Powertools for AWS Lambda (Python) V3 [${compatibleArchitecturesDescription} - Python ${pythonVersionNormalized}]${props?.includeExtras ? ' with extra dependencies' : ''
} ${props?.version ? `version ${props?.version}` : 'latest version'
}`.trim(),
// Dear reader: I'm happy that you've stumbled upon this line too! You might wonder, why are we doing this and passing `undefined` when the list is empty?
Expand Down
12 changes: 7 additions & 5 deletions test/lambda-powertools-python-layer-v3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { Template } from 'aws-cdk-lib/assertions';
import { Architecture, Runtime, RuntimeFamily } from 'aws-cdk-lib/aws-lambda';
import { LambdaPowertoolsLayerPythonV3, constructBuildArgs } from '../src';

const defaultPythonVersion = 'Python 3.12';

describe('with no configuration the construct', () => {
const stack = new Stack();
new LambdaPowertoolsLayerPythonV3(stack, 'PowertoolsLayerPythonV3');
const template = Template.fromStack(stack);
test('synthesizes successfully', () => {
template.hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: 'Powertools for AWS Lambda (Python) V3 [x86_64] latest version',
Description: `Powertools for AWS Lambda (Python) V3 [x86_64 - ${defaultPythonVersion}] latest version`,
});
});

Expand Down Expand Up @@ -106,7 +108,7 @@ describe('with arm64 architecture', () => {
const template = Template.fromStack(stack);
test('synthesizes successfully', () => {
template.hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: 'Powertools for AWS Lambda (Python) V3 [arm64] latest version',
Description: `Powertools for AWS Lambda (Python) V3 [arm64 - ${defaultPythonVersion}] latest version`,
CompatibleArchitectures: ['arm64'],
});
});
Expand Down Expand Up @@ -156,7 +158,7 @@ describe('with version configuration the construct', () => {
'AWS::Lambda::LayerVersion',
{
Description:
'Powertools for AWS Lambda (Python) V3 [x86_64] version 1.21.0',
`Powertools for AWS Lambda (Python) V3 [x86_64 - ${defaultPythonVersion}] version 1.21.0`,
},
);
});
Expand Down Expand Up @@ -184,7 +186,7 @@ describe('with version configuration the construct', () => {
'AWS::Lambda::LayerVersion',
{
Description:
'Powertools for AWS Lambda (Python) V3 [x86_64] with extra dependencies version 2.40.0',
`Powertools for AWS Lambda (Python) V3 [x86_64 - ${defaultPythonVersion}] with extra dependencies version 2.40.0`,
},
);
});
Expand All @@ -200,7 +202,7 @@ describe('with version configuration the construct', () => {
'AWS::Lambda::LayerVersion',
{
Description:
'Powertools for AWS Lambda (Python) V3 [x86_64] with extra dependencies latest version',
`Powertools for AWS Lambda (Python) V3 [x86_64 - ${defaultPythonVersion}] with extra dependencies latest version`,
},
);
});
Expand Down
Loading