https://serverless-stack.com/ logo
#help
Title
# help
j

Justas Stromilas

11/18/2021, 6:21 PM
Hi again guys, I'm having issues with python function deployment, when referencing local libraries outside the project. Suppose I have several SST projects, where each project points to a local library. When deploying, requirements.txt is generated and copied into docker, where local library can't be found anymore. My solution with STS is a bit janky, I wrap the local library with an STS project, that contains just that library and its dependencies, which will be deployed as a layer. Then I wrote a deployment script that exports the requirements.txt, replaces the local path in requirements.txt with regex to the directory in docker where it would be mounted, which is then built, deployed and referenced in other stacks. What would you guys do ? Hope I'm missing something obvious. Thanks
f

Frank

11/18/2021, 6:52 PM
Hey @Justas Stromilas, sorry to see the amount of effort that’s gone into the work around!
Do you think you can put together a minimal repo that can reproduce the issue?
I will dig into this with the team. We do want to improve the Python packaging experience.
j

Justas Stromilas

11/18/2021, 6:58 PM
Sure, I'll set that up and message you after work
f

Frank

11/18/2021, 7:19 PM
Thanks @Justas Stromilas!
j

Justas Stromilas

11/23/2021, 6:45 PM
@Frank Hey, sorry to me a while to get back to this. Here's the repo https://github.com/stromilas/local_py_repo.
Maybe we could identify the local packages by looking for
[package.source]
and
type = "directory"
in poetry.lock, then mount the given
url
inside Docker ?
f

Frank

11/23/2021, 10:59 PM
Thank @Justas Stromilas! Let me give it a spin today/tmr. Btw, do you know if there’s any bundling tools in the Python world that are similar to the esbuild and webpack of the Node.js world?
I’m not too familiar with Python. So I’m planning to take ur setup and try it out with the Zappa framework, SAM, and Serverless Framework. And see if/how they handle this case.
3 Views