aws / aws/aws-cdk

(@aws-cdk/aws-lambda-python): Support exclusion in PythonLambdaLayer

Open
#19,508 1 comment 12 reactions 0 assignees View on GitHub
@aws-cdk/aws-lambda-python effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Description

Currently when creating a PythonLambdaLayer it is not possible to exclude files, which should not be part of the layer. It should be possible to exclude files or directories as in LayerVersion.

### Use Case

The entry point must contain the Pipfile.lock. The Pipfile is usually located at the root of the project. This leads to the possibility that there might be some directories or files which should not be part of the final Layer. Hence, an option for exclusion could be beneficial.

### Proposed Solution

I think there are two possible solutions:

1. Change the entry in PythonLayerVersion from string to Code. This would add the possibility to include the exclusion in Code.from_asset(). Looking at the source code the entry parameter is later used to create a Code object anyways.
2. Add an additional parameter, which gives the user the possibility to add files/directories to exclude.

### Other information

_No response_

### Acknowledge

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

Start by tracing how PythonLayerVersion handles its entry and compare that flow with LayerVersion and Code.from_asset(), especially their exclusion support. Decide whether the API should accept Code or add an exclusion parameter; done means users can exclude files or directories from the generated Python Lambda layer while retaining the required Pipfile.lock.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.