fresh-cat-90827
03/03/2022, 8:40 PMpex_binary
declaration only, and if the entry_point
file is not listed as sources
, the PEX file is still produced, but isn’t usable since the module is absent.fresh-cat-90827
03/03/2022, 8:40 PMpex_binary(
name='pex-binary',
description='Description',
entry_point='main.py:main',
)
the workflow:
$ ls projectA
BUILD main.py
$ ./pants filedeps projectA::
projectA/BUILD
$ ./pants package projectA::
$ python3 dist/projectA/pex-binary.pex
...
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'main'
Is this intentional? I.e. if entry point specifies a file that is not under sources, it still happily packages the PEX binary, however, we know already at the packaging step that the PEX won’t be usable. Do you think we should evaluate the entry point eagerly to confirm the module specified is under sources?hundreds-father-404
03/03/2022, 8:41 PMhundreds-father-404
03/03/2022, 8:42 PMscript
field, which lets you do things like script='black'
to build black.pex
enough-analyst-54434
03/04/2022, 1:42 AMpython_source
target for internal book-keeping reasons. Pex could help here and error for all invalid entry points instead of just invalid console script entry points (it actively tries to find those in the resolved set so it can translate them to entry points and fails fast if not found). So Pex could be more uniform and blow up if an entry-point is not present in 3rdparty deps or --sources
. That blow-up would be a lot friendlier than shipping a silent broken PEX.