stale-truck-36011
05/12/2025, 3:44 PM.pex binaries with pants, and I noticed there are options to pex_binary targets that lets you include or exclude sources and dependencies.
I'm wondering if there's a smooth way to reduce packaging time in those cases where the dependencies haven't changed. For instance, we have quite a few binaries that package torch , which takes a cool 800MB and a handful of minutes to package, and it adds up to a lot of unnecessary time and resources.
Is there a nice way to incrementally build the pex, or something else? I'm open to trying out the different layout options too.
Right now we just build them with mostly default options to pex_binary.elegant-florist-94385
05/12/2025, 7:17 PMelegant-florist-94385
05/12/2025, 7:19 PM**/* from the sandbox into the new pex.elegant-florist-94385
05/12/2025, 7:20 PMelegant-florist-94385
05/12/2025, 7:21 PMstale-truck-36011
05/13/2025, 8:21 AMI think this idea is roughly what you are trying to do, but on a pex directly, is that right?Exactly š We've migrated our dockerfiles to the pattern you're suggesting, but we currently still just build one pex. What I'm not quite clear on how to do is set up the dependency pex in a way that the change inference will only trigger its build if only the dependencies have changed, and not the source code. If I just change a function body in a python file, the dependency pex shouldn't be rebuilt. If I import a new library though, it should. But to successfully infer the correct requirements, I think I need to add the same entrypoint
python_source as the full binary as a dependency.
I'll experiment a little bit and get back to you!stale-truck-36011
05/14/2025, 1:40 PMpants package , if I'm looking to benchmark the time it takes? Is it enough to set
--no-local-cache
--no-remote-cache
--no-pantsd
?happy-kitchen-89482
05/14/2025, 11:14 PMcache means on-disk caching of the results of running processes, while pantsd memoizes build graph state in memoryhappy-kitchen-89482
05/14/2025, 11:14 PMpantsd you are also measuring daemon startup overhead, which can be significantstale-truck-36011
05/16/2025, 6:42 AM