Skip to content

Include Poetry development mode local dependencies in Lambda package #697

@Pavan-bhor

Description

@Pavan-bhor

When using this module with Python projects that use Poetry for dependency management, local libraries added in "development" mode (for example, using helper_lib = { path = "../helper_lib/", develop = true } in pyproject.toml as shown below in pyproject.toml) are not included in the final Lambda package. it only includes a link to the dependency, resulting in missing code within the Lambda deployment package.

Describe the solution you'd like

Enhance the module to detect and properly package local development dependencies specified in Poetry (with develop = true), so that their source code is included in the Lambda deployment package.

Describe alternatives you've considered

Right now, to work around this, We are packaging the code via a script and using s3_existing_package option to refer that package during deployment, which can be error-prone.

Additional context

Here is an example of a typical pyproject.toml setup:

[tool.poetry]
name = "sample-project"
version = "0.1.0"
description = "A sample Python project using Poetry"


[tool.poetry.dependencies]
python = "^3.9"
requests = "^2.31.0"
helper_lib = { path = "../helper_lib/", develop = true }

[tool.poetry.dev-dependencies]
pytest = "^8.0"
black = "^24.0.0"
mypy = "^1.8.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions