Hi Guys, I’m developing on my mac and want to depl...
# development
Hi Guys, I’m developing on my mac and want to deploy a python library (with native dependencies) to a linux server. Is there a “run pants in docker” options or it’s something we need to orchestrate?
Hi Yoav! 👋 Thanks for asking. There’s currently not a builtin supported way to run pants in docker. However, I’m working on Docker support in pants, and this is a use case worth considering. I think the way to go to build on Mac that are targeted to run on linux, is to use the
field. I’ll let the others who are experts on this area chime in however.. 😉 https://www.pantsbuild.org/docs/reference-pex_binary#codeplatformscode
@curved-television-6568 thanks for the quick response! How does the platform feature work if we have to compile dependencies?
🙏 1
pip package that comes with sources but no pre-built binaries
Good question. I’ll have to defer answering that 🙂
Normally, the core team wakes up in about 6 hrs or so.. but I think @happy-kitchen-89482 is in a more favourable timezone right now, and perhaps able to provide some insights..
@melodic-thailand-99227 Regarding Docker integration, the overall progress is tracked in this issue: https://github.com/pantsbuild/pants/issues/2648#issuecomment-889916375
Hi @melodic-thailand-99227! Great question. And funnily enough one that @witty-crayon-22786 and I were discussing just yesterday.
So first I want to distinguish between two ideas: A) The Docker plugin, which is @curved-television-6568's excellent work on getting Pants to build Docker images for you, and B) Having Pants execute processes in a Docker container.
In A) the thing that is produced is a Docker image, in B) the thing that is produced is a .whl or .pex file, containing native code built for linux (but possibly built on a mac).
Right now, the way to achieve B) is to run Pants itself within a container, with your local source tree mapped via a volume into the container. The .whl/.pex file ends up in the
directory in the container, and you can pluck it out of there, again by volume mapping.
What we have been thinking about is a mode where you run Pants itself natively on your Mac, but when Pants needs to shell out to a process, it does so in a container instead of natively.
Note that Pants today already has the ability to run processes on a remote cluster, so this would leverage that ability, but with the "remote cluster" being a local container...
So this isn't scifi, it's very achievable, we just haven't had an opportunity to do it yet.
But for now I'd say your best bet to get this working right now is to run Pants in a container, with the right volume mappings. I don't know when we'll be able to make the other thing work, so I wouldn't recommend waiting for it if this is time-sensitive for you.
pip package that comes with sources but no pre-built binaries
the other way to do this is to pre-build those deps into wheels for the relevant platform, stash them, and then resolve with find-links. not ideal, but sometimes workable.