Monorepo using Serverless Compose with serverless-python-requirements breaks plugin packaging
david-a-jetter opened this issue · 0 comments
Issue description
I've also opened an issue in Serverless Compose: serverless/compose#152
I think this is ultimately an issue with this plugin though, with the expectation that the pyproject.toml
file is in the same directory as the serverless.yml
file that's being deployed.
Use case: A Python monorepo with all pypi requirements managed through Poetry in a single pyproject.toml
file, containing multiple Serverless services, each using serverless-python-requirements
plugin being migrated from serialized serverless deploy
commands to Serverless Compose. After moving each service's yml file into its own subdirectory, adding the requisite serverless-compose.yml
in the root, and running npx sls deploy
, each package's zip file contains just the source code and no python packages. The serverless-python-requirements
plugin did not run at all.
Expected Behavior: The source code matching the package.patterns
is included, as well as all non-dev python dependencies produced by serverless-python-requirements
are included.
Actual Behavior: Only the source code matching the package.patterns
is included, but the serverless-python-requirements
plugin does not run.
The repository structure is roughly outlined as:
pyproject.toml
poetry.lock
serverless-compose.yml
src/
package/
- appone/
- serverless.appone.yml
- apptwo/
- serverless.apptwo.yml
- appthree/
- serverless.appthree.yml
Workaround: Use copyfiles npm package (which ensures cross-platform compatibility) to copy the pyproject.toml
file into each app's subdirectory, eg: npx copyfiles pyproject.toml poetry.lock package/appone
before running npx sls deploy
and the serverless-python-requirements
plugin behaves as expected.
Service configuration (serverless-compose.yml) content
services:
appone:
path: package/appone
config: serverless.appone.yml
apptwo:
path: package/apptwo
config: serverless.apptwo.yml
appthree:
path: package/appthree
config: serverless.appthree.yml