aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Add pipenv support for build command

Open sthulb opened this issue 7 years ago • 5 comments

It would be cool if SAM CLI could understand Python projects that use pipenv. Right now, sam build only supports dependencies that are specified in a requirements.txt.


SAM Version: 0.8.0

sthulb avatar Nov 30 '18 18:11 sthulb

This could be a new workflow in https://github.com/awslabs/aws-lambda-builders. The current worflow is a python_pip workflow. this could be a python_pipenv workflow.

sriram-mv avatar Nov 30 '18 22:11 sriram-mv

I’ll see if I have capacity to do this next week.

sthulb avatar Nov 30 '18 22:11 sthulb

:+1:

jblakeney avatar Feb 01 '19 16:02 jblakeney

Any movement on this?

jrupp avatar Oct 07 '19 16:10 jrupp

FWIW using pipenv with PackageType: Image works fine (you can utilize it in your Dockerfile) with sam build. I seem to be having some issues getting that to work with sam local invoke, though (can't seem to find the dependencies even though they exist in my image).

EDIT: ah, this is because of the lambda entrypoint for the public.ecr.aws/lambda/python:3.8 image... it doesn't seem to be running the python commands in the same virtual environment that pipenv is using, and I can't use pipenv run since the entrypoint requires the handler to be the first function argument... I guess I can use pipenv install --system for now, even though it is discouraged.

solarmosaic-kflorence avatar Apr 13 '21 23:04 solarmosaic-kflorence

I'm going to go ahead and close this in favor of using a makefile based builder if one wants additional flexibility.

sriram-mv avatar Oct 03 '22 22:10 sriram-mv

@sriram-mv is there a chance to have this mentioned in the documentation, perhaps with an example?

matteocontrini avatar Nov 24 '22 09:11 matteocontrini