https://pantsbuild.org/ logo
#general
Title
# general
e

echoing-manchester-70122

04/28/2021, 8:31 PM
What’s the best way to use a pex with multiple entry points?
h

hundreds-father-404

04/28/2021, 9:22 PM
Hey Adam, to confirm, you want for example to have
app.ep1.pex
app.ep2.pex
, where each has the exact same code inside and same settings, and all that changes is the entry point? If so, you can leverage the fact that BUILD files are Python:
Copy code
pex_kwargs = dict(
  dependencies=[..],
  execution_mode="venv"
)

pex_binary(name='p1', entry_point='ep1', **pex_kwargs)
pex_binary(name='p2', entry_point='ep2', **pex_kwargs)
e

echoing-manchester-70122

06/02/2021, 11:06 PM
no, we want to have multiple entrypoints in a single pex
h

hundreds-father-404

06/08/2021, 10:09 PM
I see. Currently, there is no support for creating a Pex with multiple entry points, and Pex validates that you only do one of
-m
or
-c
. How are you hoping/envisioning to use multiple entry points? The issue fwict is that
-m
and
-c
are used such that
./my_pex.pex
runs with the entry point specified. Could you set up an entry point that parses the argv to do what you want?
6 Views