aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.5k stars 1.17k forks source link

Feature request: Support for Python requirements files with different names #7180

Open eruvanos opened 3 months ago

eruvanos commented 3 months ago

Describe your idea/feature/enhancement

I am using rye to manage my dependencies. While the tool is pretty new, it basically generates a requirements.txt called requirements.lock.

I wish the AWS Lambda Builders would allow to specify the manifest file within the MetaData, so I could direct it to requirements.lock file instead of requirements.txt

Proposal

Add details on how to add this to the product.

Additional Details

Example configuration I could imagine.

  BrokerFunction:
    Type: AWS::Serverless::Function
    Metadata:
      Manifest: requirements.lock
mndeveci commented 3 months ago

Thanks for feature request. Just want to confirm you can run build for a lambda function by using --manifest flag with sam build today, right? https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-build.html

eruvanos commented 3 months ago

@mndeveci yes, that works for a single requirements.txt for all functions. In my case, I have multiple functions and would like to keep the dependencies separate per function to not include unnecessary deps.

I am also not sure if it works if I have different languages within the setup. (Like a Go function and a Python function)

mndeveci commented 3 months ago

Understand. In that sense this is already a feature supported by aws-lambda-builders, however we need a way in SAM CLI side to configure it for individual functions and pass it back to lambda builders to use it as manifest file.

I am going to move this issues to aws-sam-cli repository.

If you are interested in, please don't hesitate to raise a PR, we would be happy to accept contributions.