average-breakfast-91545
03/04/2023, 2:30 PMmyorg/myapp/mycomponent/handler.py
and a BUILD for a pex_binary in mycomponent with an entrypoint of handler.py:run
, the resulting module in the binary is ___pex__.myorg.myapp.mycomponent.handler
. Is there some way to introspect that at build time and retrieve that value?
For context, I'm interested in building a plugin for the serverless framework that uses pants to build a lambda zip, but I'll need to be able to set the handler on the function correctly.enough-analyst-54434
03/04/2023, 2:34 PM__pex__
bit, no. That's magic available in all (modern) PEX files. You need to know if you're using that magic or not in the given usage context. The rest though is stored in PEX metadata:
unzip -qc my.pex PEX-INFO | jq .
enough-analyst-54434
03/04/2023, 2:34 PMenough-analyst-54434
03/04/2023, 2:35 PMpex
installed, pex-tools my.pex info
enough-analyst-54434
03/04/2023, 2:36 PM--venv
or --include-tools
then PEX_TOOLS=1 ./my.pex info
average-breakfast-91545
03/04/2023, 2:37 PMenough-analyst-54434
03/04/2023, 2:41 PM./my.pex
- but you're not doing that. The server less framework is executing the entry point you need to separately tell it about.average-breakfast-91545
03/04/2023, 2:42 PMaverage-breakfast-91545
03/04/2023, 2:43 PMenough-analyst-54434
03/04/2023, 2:45 PMaverage-breakfast-91545
03/04/2023, 2:46 PMget_foo.py
and upate_foo.py
, how would I specify separate pex_binaries for those?enough-analyst-54434
03/04/2023, 2:46 PMpython
with all it's contents on that Python's sys.path.enough-analyst-54434
03/04/2023, 2:47 PMenough-analyst-54434
03/04/2023, 2:47 PMaverage-breakfast-91545
03/04/2023, 2:50 PMenough-analyst-54434
03/04/2023, 2:50 PMpex_binary
targets if using Pants.enough-analyst-54434
03/04/2023, 2:51 PMaverage-breakfast-91545
03/04/2023, 2:51 PMenough-analyst-54434
03/04/2023, 2:52 PMaverage-breakfast-91545
03/04/2023, 2:52 PMaverage-breakfast-91545
03/04/2023, 2:53 PMso I suspect something else is going onCould well be just that I'm clueless
enough-analyst-54434
03/04/2023, 2:53 PMenough-analyst-54434
03/04/2023, 2:54 PM./my.pex
enough-analyst-54434
03/04/2023, 2:54 PMaverage-breakfast-91545
03/04/2023, 2:54 PMaverage-breakfast-91545
03/04/2023, 2:54 PMenough-analyst-54434
03/04/2023, 2:56 PMpython_source
(singular) targets to own the modules. Refer to 1 of those targets in the corresponding pex_binary
target.enough-analyst-54434
03/04/2023, 2:56 PMscript
/ entry_point
off each and still get exactly and only what you need in each.average-breakfast-91545
03/04/2023, 2:57 PMenough-analyst-54434
03/04/2023, 2:57 PMentry_point
enough-analyst-54434
03/04/2023, 2:57 PMscript
is for console scripts, which is a 3rd party thing. These only: https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html#the-console-scripts-entry-point