serverless-python-requirements icon indicating copy to clipboard operation
serverless-python-requirements copied to clipboard

feat: Support pipenv users whose Pipfile is not in servicePath (serverless.yml location)

Open alanmun opened this issue 8 months ago • 1 comments

if you have a project hierarchy like:

root/
└── src/
    ├── **/*.py
    ├── test/*.py
    └── serverless.yml
├── .env
├── Pipfile.lock
├── Pipfile
├── README.md
├── mypy.ini
└── pyproject.toml

And run sls deploy in the same dir as the serverless.yml like:

~/MyCode/root/src$ pipenv run sls deploy

Currently this plugin silently fails to detect your Pipfile. This PR adds code to bubble up until either your operating system's root dir is reached or Pipfile is found. This matches with pipenv's behavior, which is to support executing pipenv commands such as pipenv run , pipenv shell, and pipenv requirements in any subdirectory of a directory containing your Pipfile/the directory where you created your virtualenv.

With this code change, my project hierarchy which looks like the above now successfully packages my serverless project with all of the pipenv generated requirements.

Resolves #857

alanmun avatar Mar 13 '25 15:03 alanmun

@Mmarzex Hi sorry to be a bother but any chance this could get looked at? My company would appreciate the functionality :)

alanmun avatar Mar 20 '25 15:03 alanmun