What’s the best way to use a pex with multiple ent...
# general
e
What’s the best way to use a pex with multiple entry points?
h
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
no, we want to have multiple entrypoints in a single pex
h
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?