Those of you using the environment feature to buil...
# general
d
Those of you using the environment feature to build one target in multiple environments: how are you managing lockfiles? I currently have a single lockfile for the repo, but it’s looking like a I’ll need a lockfile for each platform we want to build on. Some of my targets refer directly to a given lockfile in their dependency overrides and I’d rather not have to duplicate targets to refer to the lockfile specific to the OS I’m building for. Have any of you run into this? How have you solved it?
g
I have multi environment and build just fine with a single lock file. What seems to be the issue you're running into?
d
I think possibly I've missed some lockfile magic then. Do you not have any dependencies which differ across platforms? Or do you have multiple wheels referenced for each package in your lockfile?
g
I'd have to look at specifics. It's possible non of my wheels are platform specific.
I'll look and get back to you tomorrow
d
Thanks!
If there's a way to
generate-lockfile --platforms=(ubuntu, redhat, osx...)
that would be ideal. I just haven't found any documentation to that effect
👍 1
g
@dry-analyst-73584 you're right. I just ran into this tonight. platform/arch specific wheels are added to the lock based on which platform generate-lockfile was run from. I hit this with ML libraries.
I'm pretty sure you could just force them together, but it would require custom tooling to do so. In other words, generate on both platforms, and then merge the artifacts together. I don't actually know if this would work though because I don't know what the underlying pex implementation is for lockfiles.
❤️ 1
d
Thanks Jason! I’ll dig into this some more tomorrow
g
Let me know how you solve it.
c
In
pex
speak the lockfile is
universal
. See
pex3 lock create --help
for a great deal of detail. The pattern for taking a universal lockfile and making a Pex specific to a platform is to use: https://www.pantsbuild.org/2.19/reference/targets/pex_binary#complete_platforms https://github.com/pantsbuild/pants/discussions/18756 has some more commentary in the context of AWS lambdas
❤️ 2
d
Thank you!