We have a series of `pex_binary` s that are genera...
# general
a
We have a series of
pex_binary
s that are generally like this:
Copy code
pex_binary(
    name="monitoring_stats", dependencies=[":lib"], entry_point="main:main", tags=["no_mono"]
)
This used to work, but we upgraded (2.17->2.20, because we finally got lockfiles) now get this warning:
Copy code
21:41:24.82 [WARN] Pants cannot resolve the entrypoint for the target kite/emr_jobs_pants/monitoring_stats:monitoring_stats. The entrypoint EntryPoint(module='main', function='main') might refer to the following:

  * docker/pants/tests/main.py:lib
  * kite/emr_jobs_pants/architect_breach_prevented/main.py:lib
  * kite/emr_jobs_pants/ato_stats_incremental/main.py:lib
  * kite/emr_jobs_pants/counterparties/main.py:lib
  * kite/emr_jobs_pants/data_lake_to_kafka_replay_tool/main.py:lib
  * kite/emr_jobs_pants/defender_stats/main.py:lib
  * kite/emr_jobs_pants/enforcer_classifications/main.py:lib
  * kite/emr_jobs_pants/global_domain_ranking/main.py:lib
  * kite/emr_jobs_pants/guardian_simulated/main.py:lib
  * kite/emr_jobs_pants/monitoring_stats/main.py:lib
  * kite/emr_jobs_pants/user_directory_stats/main.py:lib
I've tried to add the path from the root of the repo in the entrypoint, but then I get:
Copy code
native_engine.IntrinsicError: Unmatched glob from kite/emr_jobs_pants/monitoring_stats:monitoring_stats's `entry_point` field: "kite/emr_jobs_pants/monitoring_stats/kite/emr_jobs_pants/monitoring_stats/main.py"
If I put
main.py:main
, I get a very similar warning as the first one, so I'm not sure exactly how to handle this.
s
Have you tried a relative path?
a
Well,
main.py
is a relative path 🙂
If I use the path from the root of the repo
kite/emr_jobs_pants/monitoring_stats/main.py
, I get that IntrinsicError I pasted in my original message
s
in the spirit of trial and error does
./main:main
do anything different?
a
Copy code
21:59:21.35 [WARN] Pants cannot resolve the entrypoint for the target kite/emr_jobs_pants/monitoring_stats:monitoring_stats. The entrypoint EntryPoint(module='./main.py', function='main') might refer to the following:

  * docker/pants/tests/main.py:lib
  * kite/emr_jobs_pants/architect_breach_prevented/main.py:lib
  * kite/emr_jobs_pants/ato_stats_incremental/main.py:lib
  * kite/emr_jobs_pants/counterparties/main.py:lib
  * kite/emr_jobs_pants/data_lake_to_kafka_replay_tool/main.py:lib
  * kite/emr_jobs_pants/defender_stats/main.py:lib
  * kite/emr_jobs_pants/enforcer_classifications/main.py:lib
  * kite/emr_jobs_pants/global_domain_ranking/main.py:lib
  * kite/emr_jobs_pants/guardian_simulated/main.py:lib
  * kite/emr_jobs_pants/monitoring_stats/main.py:lib
  * kite/emr_jobs_pants/user_directory_stats/main.py:lib
I mean, if worse comes to worst, I can just rename the
main.py
files to not be ambiguous.
s
another trial and error question. When specifying absolute paths I'll prefix them with
//:
sometimes
But that's a shot in the dark
a
Absolute paths won't work, long term, every developer has a different path, the CI has a different one as well
And, it didn't work anyway:
Copy code
pants.engine.target.InvalidTargetException: kite/emr_jobs_pants/monitoring_stats/BUILD.pants:12: The entry point for kite/emr_jobs_pants/monitoring_stats:monitoring_stats can only contain one colon separating the entry point's module from the entry point function in that module; given: '//:/home/cris.birzan/PycharmProjects/cr_python/kite/emr_jobs_pants/monitoring_stats/main.py:main'
Unless I misunderstood what you wanted me to try 🙂
Either way, I'm not even sure this is a problem, there's a more fundamental problem with packaging these, but this was the first one I saw 🙂
c
Yea, renaming seems like the easiest workaround for now. This seems to be related to the fix done for python distributions where Benjy added disambiguation for cases like these based on relative closeness to the target, iirc.
a
Okay, thanks!
c
This was the ticket I was thinking of: https://github.com/pantsbuild/pants/issues/17927 @happy-kitchen-89482 I think this is may be another example/case for the above ticket that got overlooked (or simply wasn't discovered yet)?
h
Yeah, this seems like an overlooked case for that disambiguation