In pants <2.20, we were able to have a scenario li...
# general
h
In pants <2.20, we were able to have a scenario like
Copy code
python_sources(
   name="my_parametrized_source",
   overrides={
      "some_source.py": {
         "dependencies": parametrize(variant1=[":some_thing"], variant2=[":another_thing"])
      }
   }
)

pex_binary(
   name="my_binary",
   entry_point="some_source.py",
   dependencies=["//some_source.py:my_parametrized_source@variant1"]
)
and things just worked. In >=2.20, you get
UnownedDependencyError
on inferring the entry point to the
pex_binary
and then it lists out all the parametrized options.
So, was this a bug that it was working before for us?
It works if you switch
entry_point
to
executable
, but I'm not really sure why.
fwiw, after consulting docs, I think
executable
is the correct use of what we're going for
b
ah, bummer about the breakage, and forcing you to make changes without warnings. That's not so good.
Ah, hm, potentially
entry_point="//some_source.py:my_parametrized_source@variant1"
may both stop the error and eliminate the need for the explicit
dependencies=[...]
setting? (I'm not sure if
entry_point
allows a full target address, instead of just a file path)
h
Hmmm, curious which commit in 2.20 caused this
h
Haven't tried out the above since
executable
worked fine. I don't think the target address for
entry_point
works that way, though.
The docs say it will interpret the stuff after
:
as a function definition in the module
b
@happy-kitchen-89482, I think this is https://github.com/pantsbuild/pants/pull/20390
The docs say it will interpret the stuff after
:
as a function definition in the module
Ah, right. That's unfortunate. --- I've filed https://github.com/pantsbuild/pants/issues/20806 because it seems like this warning is both redundant and unsilenceable
h
Just tried out 2.19.3rc1 and it appears to be fixed there
b
I think the 2.19 series doesn't have this new warning. I'd guess it's still visible in the latest 2.20.x series, since we haven't had a chance to land https://github.com/pantsbuild/pants/pull/20853
h
I was able to run a
pants dependents
command as my signal. Previous versions were failing
b
Ah, hm. I think your original message indicates that only >=2.20 was failing? Or were there (other?) problems in 2.19 too?
h
Oh, yeah you're right here. 2.19.2 was just as happy
Do you know what version this is scheduled to get fixed in? 2.19 is listed as deprecated in the docs and the dev release for 2.23 does not resolve.
b
I don't think someone has fixed this yet, sorry, so no release scheduled. That PR is still open and references https://pantsbuild.slack.com/archives/C0D7TNJHL/p1714260455658849 as suggesting it needs to be done a different way
h
I think 2.23.0 looks to have fixed this
Well partially. It fixes the entry_point specification, but messes with actually invoking the pex
I can cludge my way around the rest using
PEX_MODULE
environment variables