-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monorepo with serverless-python-requirements breaks plugin packaging #152
Comments
I'm understanding this is the problem? Do you get the same issue if you run |
@mnapoli Thanks for the response. Yes, that bit you highlight is the problem. I edited my issue to clearly state expected + actual behavior to help clarify any future readers as well. Running from within the individual service directory results in the same undesirable behavior (no python dependencies included). Copying the |
Thanks! Sorry I'm not familiar with Python's tooling here, but it seems like it's not related to Compose directly. It's more that Maybe Compose created a false expectation here that things would work by putting it at the root? |
@mnapoli Yeah, I think you're right - this is more of an issue with how the plugin behaves, expecting that the I've opened an issue in their github as well: serverless/serverless-python-requirements#714 I figured having one here would help with visibility, and hopefully people stumble across the workaround that, while it seems simple enough, it took me several hours of headscratching to finally come up with 😅 |
@david-a-jetter yes i just got this issue. When i deploy from the compose the serverless-python-requirements doesn't run but when i run it inside the serverless.yml file it works fine. |
@david-a-jetter We're running into same issue, appreciate you opening issues and talking about work-around 🙏🏽 |
Not sure if this is the correct repo to ask this question in, but what's the suggested workflow for using a virtualenv with serverless-python-requirements inside a serverless-compose project? Prior to using serverless-compose, I'd activate the venv inside my serverless project and that venv had all the correct python packages that my project needed (saved in However, after putting the same serverless project into a serverless-compose structure, the python dependencies are no longer packaged when I deploy the serverless-compose project, even when I run it with the venv activated. I'm not sure if this is because the serverless-compose deployment process is running outside the venv, or because serverless-python-requirements isn't being invoked correctly in the serverless-compose process. |
Are you certain it's a bug?
Are you using the latest version?
Is there an existing issue for this?
Issue description
I'm not sure if this is better filed here or in https://github.com/serverless/serverless-python-requirements
Use case: A Python monorepo with all pypi requirements managed through Poetry in a single
pyproject.toml
file, containing multiple Serverless services, each usingserverless-python-requirements
plugin being migrated from serializedserverless deploy
commands to Serverless Compose. After moving each service's yml file into its own subdirectory, adding the requisiteserverless-compose.yml
in the root, and runningnpx sls deploy
, each package's zip file contains just the source code and no python packages. Theserverless-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 byserverless-python-requirements
are included.Actual Behavior: Only the source code matching the
package.patterns
is included, but theserverless-python-requirements
plugin does not run.The repository structure is roughly outlined as:
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 runningnpx sls deploy
and theserverless-python-requirements
plugin behaves as expected.Service configuration (serverless-compose.yml) content
Command name and used flags
npx serverless deploy --stage dev
Command output
The text was updated successfully, but these errors were encountered: