Have you read the Contributing Guidelines on issues?
Prerequisites
Description
I've installed pact-python==3.4.0, pact-python-cli==2.6.0.1, and pact-python-ffi==0.5.4.0. The way that _find_executable is implemented seems a bit strange. Unless the PACT_USE_SYSTEM_BINS environment variable is set, the function seems to look for the executable in a folder bin relative to pact-python-cli/src/pact_cli/__init__.py. Which would be something like this:
__file__ = "~/projects/myproject/.venv/lib/python3.13/site-packages/pact_cli/__init__.py"
Path(__file__).parent == "~/projects/myproject/.venv/lib/python3.13/site-packages/pact_cli"
Path(__file__).parent.resolve() == "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact_cli"
Path(__file__).parent.resolve() / "bin" == "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact_cli/bin"
While the file is actually located inside /home/markus/projects/myproject/.venv/bin.
Reproducible demo
No response
Steps to reproduce
I've only installed the library. pact-python-cli is pulled in through a dependency. When using the library from the repo's checkout /home/markus/projects/myproject it works fine. But when using a git worktree at /home/markus/projects/myproject-worktrees/branch-name-1 while reusing the same virtual environment, I get the error that the pact-plugin-cli executable cannot be found.
Expected behavior
I'd expect the function to correctly locate the executable.
Actual behavior
Cut down to the part that I can share.
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/some_library/pact_testing.py", line 9, in <module>
import pact.v2 as pact_v2
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact/v2/__init__.py", line 4, in <module>
from pact.v2.broker import Broker
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact/match/__init__.py", line 338, in __import__
return __builtins_import(name, globals, locals, fromlist, level)
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact/generate/__init__.py", line 167, in __import__
return __builtins_import(name, globals, locals, fromlist, level)
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact/v2/broker.py", line 9, in <module>
from pact_cli import _telemetry_env
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact/match/__init__.py", line 338, in __import__
return __builtins_import(name, globals, locals, fromlist, level)
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact/generate/__init__.py", line 167, in __import__
return __builtins_import(name, globals, locals, fromlist, level)
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact_cli/__init__.py", line 217, in <module>
PLUGIN_CLI_PATH = _find_executable("pact-plugin-cli")
File "/home/markus/projects/myproject/.venv/lib/python3.13/site-packages/pact_cli/__init__.py", line 181, in _find_executable
warnings.warn(
~~~~~~~~~~~~~^
f"Bundled {executable} binary not found; "
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
stacklevel=2,
^^^^^^^^^^^^^
)
^
RuntimeWarning: Bundled pact-plugin-cli binary not found; using system installation instead.
Your environment
- Arch Linux
- No system-wide pact installed libraries
- Python 3.13
Self-service
Have you read the Contributing Guidelines on issues?
Prerequisites
pact-python.Description
I've installed
pact-python==3.4.0,pact-python-cli==2.6.0.1, andpact-python-ffi==0.5.4.0. The way that_find_executableis implemented seems a bit strange. Unless thePACT_USE_SYSTEM_BINSenvironment variable is set, the function seems to look for the executable in a folderbinrelative topact-python-cli/src/pact_cli/__init__.py. Which would be something like this:While the file is actually located inside
/home/markus/projects/myproject/.venv/bin.Reproducible demo
No response
Steps to reproduce
I've only installed the library. pact-python-cli is pulled in through a dependency. When using the library from the repo's checkout
/home/markus/projects/myprojectit works fine. But when using a git worktree at/home/markus/projects/myproject-worktrees/branch-name-1while reusing the same virtual environment, I get the error that thepact-plugin-cliexecutable cannot be found.Expected behavior
I'd expect the function to correctly locate the executable.
Actual behavior
Cut down to the part that I can share.
Your environment
Self-service