Simply put:
pip install -r <(poetry export) -t out/
poetry export
outputs a pinned version of packages in the same format as a
requirements.txt.
Package as a lambda function in Gitlab CI:
# .gitlab-ci.yml
stages:
- package
package:
stage: package
image: python:3.10
variables:
POETRY_HOME: /usr/local
before_script:
- curl -sSL https://install.python-poetry.org | python3 - # install poetry
- apt-get update && apt-get install -y zip # install zip
script:
- pip install -r <(poetry export) -t out/
- cp src/*.py out/
- cd out
- zip -r lambda.zip .
artifacts:
paths:
- lambda.zip