<#20594 `pex_binary` `entry_point` is silently ign...
# github-notifications
c
#20594 `pex_binary` `entry_point` is silently ignored if in different resolve Issue created by jasonwbarnett Describe the bug I was onboarding a monorepo that has 100's of
pyproject.toml
. I went through the onboarding process with
pants tailor ::
which generated all of the
BUILD
files. After which I added
pex_binary
to one of the
BUILD
files . Then I enabled
[python].enable_resolves
and added a couple of new
[python.resolves]
and updated the
BUILD
file to use the new one I created. When I ran the generated pex binary I was getting an import error. I attempted to manually add the
dependencies
at which point pants had a beautiful error message which essentially guided me through adding all of the sub modules to the same
resolve
. After updating them all and re-running pants package the binary worked as expected. I was then able to remove the explicitly defined
dependencies
and everything continued to work. My expectation is that if pants detects a dependency isn't using the same
resolve
it should warn about this situation. For more context, this is a full diff of what was required to fix the my issue:
Copy code
diff --git i/utility/company-devops/company_devops/BUILD.pants w/utility/company-devops/company_devops/BUILD.pants
index db46e8d6c9..fcc078087a 100644
--- i/utility/company-devops/company_devops/BUILD.pants
+++ w/utility/company-devops/company_devops/BUILD.pants
@@ -1 +1 @@
-python_sources()
+python_sources(resolve="company-devops")
diff --git i/utility/company-devops/company_devops/azure_devops/BUILD.pants w/utility/company-devops/company_devops/azure_devops/BUILD.pants
index db46e8d6c9..fcc078087a 100644
--- i/utility/company-devops/company_devops/azure_devops/BUILD.pants
+++ w/utility/company-devops/company_devops/azure_devops/BUILD.pants
@@ -1 +1 @@
-python_sources()
+python_sources(resolve="company-devops")
diff --git i/utility/company-devops/compdev/BUILD.pants w/utility/company-devops/compdev/BUILD.pants
index 0c23d586da..2db6047e1a 100644
--- i/utility/company-devops/compdev/BUILD.pants
+++ w/utility/company-devops/compdev/BUILD.pants
@@ -1,10 +1,11 @@
-python_sources()
+python_sources(resolve="company-devops")
 
 pex_binary(
     name="pex_binary",
     entry_point="main.py",
+    dependencies=[
+      "utility/company-devops/company_devops",
+      "utility/company-devops/compdev",
+    ],
     resolve="company-devops",
 )
diff --git i/utility/company-devops/compdev/commands/BUILD.pants w/utility/company-devops/compdev/commands/BUILD.pants
index db46e8d6c9..fcc078087a 100644
--- i/utility/company-devops/compdev/commands/BUILD.pants
+++ w/utility/company-devops/compdev/commands/BUILD.pants
@@ -1 +1 @@
-python_sources()
+python_sources(resolve="company-devops")
Pants version 2.19 pants.toml
Copy code
[GLOBAL]
pants_version = "2.19.0"

backend_packages = [
  "pants.backend.docker",
  "pants.backend.experimental.python.lint.ruff",
  "pants.backend.experimental.tools.yamllint",
  "pants.backend.python",
  "pants.backend.python.lint.black",
  "pants.backend.python.typecheck.mypy",
  "pants.backend.shell.lint.shellcheck",
  "pants.backend.shell.lint.shfmt",
]

[source]
marker_filenames = ["pyproject.toml"]

[python]
interpreter_constraints = ['>=3.9,<3.11']
enable_resolves = true
default_resolve = "python-default"

[python.resolves]
python-default = "python-default.lock"
company-devops = "utility/company-devops/pants.lock"
OS MacOS Additional info One more note, before updating the
BUILD
files with
resolve
pants dependencies --transitive
returned no dependencies.
Copy code
$ pants dependencies --transitive utility/company-devops/compdev:pex_binary
After making the changes described in the diff above, it now shows the correct
dependencies
, even with the explicitly defined
dependencies
was removed.
Copy code
$ pants dependencies --transitive
utility/company-devops/company_devops/azure_devops/__init__.py
utility/company-devops/company_devops/azure_devops/check_pr_description.py
utility/company-devops/company_devops/azure_devops/delete_offline_agents.py
utility/company-devops/compdev/commands/ado.py
utility/company-devops/compdev/main.py
utility/company-devops/pants.lock:_company-devops_lockfile
utility/company-devops/pyproject.toml:poetry
utility/company-devops:poetry#click
utility/company-devops:poetry#requests
pantsbuild/pants