Skip to content
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ _site/
.sass-cache
.jekyll-cache
.jekyll-metadata
vendor
vendor
.trivy_out/
25 changes: 0 additions & 25 deletions .trivy_out/license_scan.txt

This file was deleted.

6 changes: 6 additions & 0 deletions .trivyignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ vulnerabilities:
- id: CVE-2026-27142
statement: asdf go stdlib
expired_at: 2026-06-01
- id: CVE-2026-27142
statement: asdf go stdlib
expired_at: 2026-06-01
- id: CVE-2026-32141
statement: flatted
expired_at: 2026-06-01
24 changes: 22 additions & 2 deletions packages/cdkConstructs/src/constructs/PythonLambdaFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ export interface PythonLambdaFunctionProps {
* @default Architecture.X86_64
*/
readonly architecture?: Architecture
/**
* Any files to exclude from the Lambda asset bundle.
* Defaults to these files
* "tests",
* "pytest.ini",
* ".vscode",
* "__pycache__",
* "*.pyc"
*/
readonly excludeFromAsset?: Array<string>

}

export class PythonLambdaFunction extends Construct {
Expand Down Expand Up @@ -167,7 +178,14 @@ export class PythonLambdaFunction extends Construct {
layers = [], // Default to empty array
timeoutInSeconds = 50,
runtime = Runtime.PYTHON_3_14,
architecture = Architecture.X86_64
architecture = Architecture.X86_64,
excludeFromAsset = [
"tests",
"pytest.ini",
".vscode",
"__pycache__",
"*.pyc"
]
} = props

const {logGroup, role, insightsLayer} = createSharedLambdaResources(this, {
Expand Down Expand Up @@ -196,7 +214,9 @@ export class PythonLambdaFunction extends Construct {
functionName: functionName,
architecture,
handler: handler,
code: Code.fromAsset(join(projectBaseDir, packageBasePath)),
code: Code.fromAsset(join(projectBaseDir, packageBasePath), {
exclude: excludeFromAsset
}),
role,
environment: {
...environmentVariables,
Expand Down
Loading