modern-wolf-36228
09/05/2021, 8:25 AMpex -c
way.happy-kitchen-89482
09/06/2021, 8:57 AMpex_binary
for example?modern-wolf-36228
09/06/2021, 8:58 AMpex_binary
.modern-wolf-36228
09/06/2021, 8:59 AMpex_binary()
?happy-kitchen-89482
09/06/2021, 10:08 AMhappy-kitchen-89482
09/06/2021, 10:10 AMhappy-kitchen-89482
09/06/2021, 10:10 AMhappy-kitchen-89482
09/06/2021, 10:10 AMpex_binary
?modern-wolf-36228
09/06/2021, 10:11 AMhappy-kitchen-89482
09/06/2021, 10:12 AMmodern-wolf-36228
09/06/2021, 10:14 AMentry_point
(entry_pont="<none>"), is it possible to do something like ./dist/sources/binary.pex <console_script> <args>
?happy-kitchen-89482
09/06/2021, 10:29 AMPEX_SCRIPT=<console_script> ./dist/sources/binary.pex <args>
happy-kitchen-89482
09/06/2021, 10:29 AMhappy-kitchen-89482
09/06/2021, 10:30 AMmodern-wolf-36228
09/06/2021, 10:36 AMenough-analyst-54434
09/06/2021, 2:17 PMhundreds-father-404
09/07/2021, 7:20 AMentry_point
. Do we keep that field and use it for both -m
and -c
, with some syntax to differentiate? Have two fields, and require one is set but not both? If two fields, what do we name it?
With those questions answered, it's trivial to implementenough-analyst-54434
09/07/2021, 12:12 PM-c / --script / --console-script
flag, we have a tight name pool for a new field. Since the value of a script or console script can - and ususually does - collide with valid module names - which are valid entry_point values, we'd need to introduce syntax as you point out and that would be a Pants-ism you'd need to learn to use your existing tool knowledge - we just got in the way. I don't think we have mutex fields yet for any targets we ship, so this would be new in the codebase. Certainly mutex options are not new to users though.hundreds-father-404
09/07/2021, 1:03 PMconsole_script
being a new field. And yeah, entry_point
still makes sense given Pex's opt being -m/-e/--entry-point
.
To check my understanding of console scripts...I don't think we need any special syntax for file paths like we have with entry_point
, right? Because console scripts come from the metadata of distributions, not from loose files.
We could possibly implement dependency inference, that -c black
infers a dep on //:black
, but not sure how reliable that is since a console script's name need not == the dist's nameenough-analyst-54434
09/07/2021, 1:43 PMTo check my understanding of console scripts...I don't think we need any special syntax for file paths...Correct.
We could possibly implement dependency inference,...It should be deemed completely unreliable. The only way to dep infer would be to download all declared 3rdparty dists and then look at their metadata to see if they have a script or console script with the given name, then add a dep on that dist.
enough-analyst-54434
09/07/2021, 1:46 PMconsole_script
would be a lie, since Pex can accept a script or a console_script. These naturally share a namespace since they generate an entry in a venv's bin/
dir. I think you have to pick script
and explain it can be either since script is a generic word that accepts either use whereas console_script rejects the script use at 1st blush.happy-kitchen-89482
09/07/2021, 4:43 PMmain
field that takes one of two typeshappy-kitchen-89482
09/07/2021, 4:43 PMhundreds-father-404
09/07/2021, 4:46 PMenough-analyst-54434
09/07/2021, 5:01 PMhappy-kitchen-89482
09/08/2021, 1:55 PMhundreds-father-404
09/09/2021, 3:07 AMentry_point
and no script
?
Thus far, we've required you set entry_point="<none>"
to be extra explicit - a common gotcha seemed to be forgetting to set the entry point
It would be overly verbose imo to make you do pex_binary(entry_point="<none>", script="<none>")
. Seems weird to still require pex_binary(entry_point="<none>")
, given that this is valid: pex_binary(script="foo")
(where entry_point is left off)
we've required you setI think the best we can do is give up on this?to be extra explicit - a common gotcha seemed to be forgetting to set the entry pointentry_point="<none>"
pex_binary()
is now legal, and you'll hopefully figure out from docs that you're missing setting one of the two fieldsenough-analyst-54434
09/09/2021, 3:57 AMbool
, int
, folat
str
, set
,list
, dict
though would make modeling straight forward. If we had the doc system to support exposed objects you'd use a single field, say exe: MainSpecification
and expose Script(script: str)
/ EntryPoint(module: str, func: str | None = None)
/ NoExe()
variants and force one. We seem to be FAPP hamstringing ourselves with ~json syntax even though we parse with Python.hundreds-father-404
09/10/2021, 6:26 PM./pants package
🙂 thanks for the feature request!modern-wolf-36228
09/10/2021, 6:49 PM