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

high-yak-85899

04/13/2022, 12:58 AM
This is related to https://github.com/pantsbuild/pants/issues/14983, but when a pex depends on a distribution, does that do something funny with the module used for
entry_point
? I'm seeing my module specified as
entry_point
somehow end up in a traceback like
/home/nathanael/.pex/installed_wheels/64f793b8414b45d023fab18cdb41b8298ed2f8d103ec032118f40b5ad1289e2f/my_distribution-0.0-py3-none-any.whl/path/to/my_module.py
When I remove the dependence on the distribution, the built pex goes back to using the module I expect it to (and not some older form of it like I mention in the ticket)
I can actually get around it for now by not depending on a distribution and doing something different, but pretty odd nonetheless
e

enough-analyst-54434

04/13/2022, 1:10 AM
From a PEX standpoint the entrypoint is just looked up on the sys.path. If its present in mulltiple distributions / loose source on the sys.path, the leftmost sys.path entry where it exists should win.
h

high-yak-85899

04/13/2022, 1:11 AM
That makes sense. It feels like the build process is inserting it erroneously, though. Since I don't see any linking between
my_distribution
and
my_module.py
e

enough-analyst-54434

04/13/2022, 1:11 AM
But if we've got code included multiply on the sys.path, that's a losing proposition generally. C.F.: Discussion about versions today and the JVM.
SO you're saying
my_distribution
comes from a
python_distribution
target and the transitive file deps of that target should not include
my_module
?
h

high-yak-85899

04/13/2022, 1:13 AM
Yes and that's what my use of
./pants dependencies --transitive
seems to be telling me
e

enough-analyst-54434

04/13/2022, 1:13 AM
Huh. So then this bug report can be unmuddied - the package goal is doing the wrong thing on your
python_distribution
target then.
h

high-yak-85899

04/13/2022, 1:14 AM
I wouldn't quite say that. When I build and inspect the package, I don't see
my_module.py
included.
So I think
./pants package //:my_distribution
does the right thing
e

enough-analyst-54434

04/13/2022, 1:14 AM
Huh - that is very strange then.
Internally when a
pex_binary
depends on a
python_distribution
the rules that power the
package
goal should be exactly what are run on the
python_distribution
before it gets added to the PEX file.
That's definitely worth filing a targeted bug at.
The narrower and more detailed you can get a repro, the better of course.
h

high-yak-85899

04/13/2022, 1:16 AM
Okay, I'll try to detail that out better. Thanks for providing a gut check on it.