broad-processor-92400
03/31/2023, 7:22 AMpip install
supports a --target /path/to/dir
argument to install the reqs directly into that directory, without the usual venv structure. This is very handy for building lambda functions/layers, because doing that generally gives a directory that works as the root of a function/layer (e.g. it's what AWS's CDK does in their lambda packaging construct).
Is there way to achieve something similar within when given a PEX file (or via the PEX CLI)?
I'm going to experiment with PEX_TOOLS=1 file.pex venv $(mktemp)
and using the contents of the lib/python*/site-packages/
directory alone, dropping the rest of the venv structure, but that doesn't seem particularly right, on the surface...average-breakfast-91545
03/31/2023, 8:36 AMpython
directory.
https://github.com/bobthemighty/pants-lambda-layer/tree/master/pants-plugins
I've not used it in anger yet, but it's worked in prototypes, and I'll probably be running it for real today.enough-analyst-54434
03/31/2023, 8:44 AMrepository
subcommands. Now they don't help here, they only deal with 3rd party and the venv shenanigans deals with 1st and 3rd party. However, knowing those subcommands exist on top of venv
pretty much makes the case that PEX tools should just support this case you both have directly.broad-processor-92400
04/02/2023, 1:01 AMenough-analyst-54434
04/02/2023, 1:29 AMbroad-processor-92400
04/02/2023, 2:27 AMpydantic
), and cannot seem to use the tools to extract it when running them on macOS, or arm64 linux.
https://gist.github.com/huonw/adbd1d685f595d10780e5f878a5245cd spells out what I tried.
(To be clear, I'm willing to try the new environments to run the PEX within an appropriate image, so a feature here would be an optimisation.)enough-analyst-54434
04/02/2023, 2:38 AMbroad-processor-92400
04/02/2023, 2:45 AMenough-analyst-54434
04/02/2023, 2:49 AMbroad-processor-92400
04/02/2023, 2:51 AMenough-analyst-54434
04/02/2023, 4:47 AMTargets
internally, which is a standard input to both a Pip resolve and a boot resolve from a PEX. The default target is the current interpreter, you don't want that, you want the target(s) specified by those args, in particular --complete-platform.broad-processor-92400
04/04/2023, 4:12 AM