Hey folks, I've got an Azure-grade problem. We've ...
# general
Hey folks, I've got an Azure-grade problem. We've got an Azure Function App which we package into a docker container. We currently use poetry-based lockfiles so we can pip install dependencies in the docker container. We'd like to use PEX instead since it has better integration with pants, like dependency inference and future support. The problem is that Azure Functions don't really have an entry point to designate as a pex_binary target. Does anyone have ideas? I tried installing the dependencies with PEX directly (
pex -r requirements.txt --lock requirements.lock
), but it didn't like the header pants put on that file.
Have you seen https://github.com/pantsbuild/pants/discussions/17828, including the comment within the thread that describes how someone got something working?
Pants has built-in support for AWS Lambdas and GCP Cloud Functions, if someone is motivated to add Azure Function support, I imagine it would be ~similar?
But that thread has a way to get things working in practice
Oh, I haven't seen that, thanks for linking it! We're deploying slightly differently, but think I can swing something from what's in there
I'd be interested to hear if you get something working @careful-address-89803. It's something I'd like to do down the road as well. If you do get something working could you add a comment to that thread ^ or anywhere else. Really there should probably be an issue for az function app integration.
I’m trying to do this as well, but I’m getting a module not found error at the
import __pex__
statements when the functions run. I added the imports to the top of the entry point files as described in the linked GitHub discussion. Removing those imports results in module not found errors for third party dependencies that are packaged in the pex binary. Has anyone else had any luck? Update: just built a pex with that repo and noticed that the pex binary I’ve been building is missing the top-level
directory. We’ve been using Pants version 2.12. After upgrading to 2.14 the pex binary contains the
directory and the functions run successfully in Azure. 🎉
Did a writeup for what we did for Docker-based Function Apps here
🙌 1