-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pex CLI doesn't offer as much control over pex building process as the PEXBuilder #1907
Comments
@hrfuller can you provide more detail on item 1? What would make sense? Right now you can only use multiple On 2 can you provide more color? Pex already never installs a given wheel more than once for a given PEX_ROOT. If the wheel has already been installed there (in |
Basically I need a lot more detail about the environmental constraints you use Pex under I think as well as the perf improvements you get in % terms using your current techniques over some example PEX CLI baseline. With that info in hand, I can come up with real answers or ideas or infeasibles. |
@hrfuller you were not able to provide more details and Pex has since grown even more ways to pick sources, now including:
I'm going to assume the details won't be forthcoming and close, but please re-open if you have more specifics about cases modern Pex does not handle well via the CLI that you think it should. |
I totally missed item 2. Although you can now # Existing perf for pre-resolved wheel house:
:; time python -mpex --pip-version latest --no-pre-install-wheels /tmp/wheels/*.whl --intransitive -otorch.pex
/home/jsirois/dev/pex-tool/pex/pex/pex_builder.py:105: PEXWarning: The PEX zip at torch.pex~ is not a valid zipapp: Could not find the `__main__` module.
This is likely due to the zip requiring ZIP64 extensions due to size or the
number of file entries or both. You can work around this limitation in Python's
`zipimport` module by re-building the PEX with `--layout packed` or
`--layout loose`.
pex_warnings.warn(message)
real 0m10.857s
user 0m6.478s
sys 0m3.873s
# A quick hack that allows adding all wheels in `PEX_WHEELS_DIR` to the PEXBuilder directly:
:; time PEX_WHEELS_DIR=/tmp/wheels python -mpex --pip-version latest --no-pre-install-wheels -otorch.pex
/home/jsirois/dev/pex-tool/pex/pex/pex_builder.py:105: PEXWarning: The PEX zip at torch.pex~ is not a valid zipapp: Could not find the `__main__` module.
This is likely due to the zip requiring ZIP64 extensions due to size or the
number of file entries or both. You can work around this limitation in Python's
`zipimport` module by re-building the PEX with `--layout packed` or
`--layout loose`.
pex_warnings.warn(message)
real 0m6.376s
user 0m3.977s
sys 0m2.451s On the precedent front there is --requirements-pex FILE
Add requirements from the given .pex file. This option
can be used multiple times. (default: []) So I'll re-open to fix item 2 in the OP. |
Thanks John! I haven't been involved with pex since some job changes but if you still feel like 2 would be a benefit to the project that's great. There has been talk of a pex_binary target in bazel rules_python for sometime. Based on my experience writing bazel rules for pex these changes would have given more control over the final pex that is created. Cheers. As for details in number 1 I'm a bit hazy now but it had to do with merging directories that represented the same "source root" a pants concept into the pexes being created. This was using a much older version of pex v2 so that may have changed already |
Hey Henry! Yeah, I think 2 makes sense as a feature on its own. As to 1, I'm still hazy too. you could definitely merge source roots just using |
When building a PEX or creating a venv via `pex3 venv create` you can now tell Pex to use a set of pre-resolved distributions. This is similar to using `--no-pypi --find-links ...` except that: 1. Its roughly 3x faster since Pip is not asked to do any resolution. 2. It requires all the distributions specified form an already complete resolve. One way to obtain distributions that meet criteria 2 is to use `pip download -d ...` or `pip wheel -w ...` to pre-resolve the distributions you need. Closes pex-tool#1907
When building a PEX or creating a venv via `pex3 venv create` you can now tell Pex to use a set of pre-resolved distributions. This is similar to using `--no-pypi --find-links ...` except that: 1. Its roughly 3x faster since Pip is not asked to do any resolution. 2. It requires all the distributions specified form an already complete resolve. One way to obtain distributions that meet criteria 2 is to use `pip download -d ...` or `pip wheel -w ...` to pre-resolve the distributions you need. Closes #1907
As a major PEX user twitter leverages the PEXBuilder class to build pexes instead of shelling out to the PEX cli for a few reasons.
--sources-directory
option to add sources to a pex doesn't offer fine enough control over the final import paths of source files. In order to make--sources-directory
work we would have to prepare all the sources in merged directories. E.g Often multiple directories need to be merged into the same Chroot directory.--requirement
on the CLI and even the mainPEXBuilder.add_distribution
methods to add significant overhead by invoking pip.pex for each distribution. We can improve build times significantly by relying on the existence of a mechanism for fetching 3rdparties that is outside of pex itself.These may not be things that the Pex CLI wants to support but figured I would list them out based on the fact that PEXBuilder isn't under a stable API contract with users.
The text was updated successfully, but these errors were encountered: