pact-python-cli 2.6.0.0__py3-none-win_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pact_cli/.gitkeep ADDED
File without changes
pact_cli/__init__.py ADDED
@@ -0,0 +1,246 @@
1
+ """
2
+ Locate and provide paths to bundled or system Pact CLI executables.
3
+
4
+ This module exists solely to bundle and distribute the Pact CLI tools as a
5
+ Python package. It does not provide any substantive functionality beyond
6
+ locating the Pact CLI executables and providing their paths for use in Python
7
+ code.
8
+
9
+ The module exposes constants for the absolute paths to the Pact CLI executables (such as
10
+ `pact-broker`, `pact-message`, `pact-mock-service`, and `pact-provider-verifier`).
11
+
12
+ By default, the module will use the binaries bundled with the package. If the
13
+ environment variable `PACT_USE_SYSTEM_BINS` is set to `TRUE` or `YES`, or if the bundled
14
+ binaries are unavailable, it will fall back to using the system-installed Pact CLI tools
15
+ if found in the system PATH.
16
+
17
+ This package is intended for use as a dependency to ensure the Pact CLI is available in
18
+ Python environments, such as CI pipelines or local development, without requiring a
19
+ separate installation step.
20
+
21
+ For more information, see the project README or
22
+ https://github.com/pact-foundation/pact-python.
23
+ """
24
+
25
+ from __future__ import annotations
26
+
27
+ __author__ = "Pact Foundation"
28
+ __license__ = "MIT"
29
+ __url__ = "https://github.com/pact-foundation/pact-python"
30
+
31
+ import os
32
+ import shutil
33
+ import sys
34
+ import warnings
35
+ from pathlib import Path
36
+ from typing import TYPE_CHECKING
37
+
38
+ from pact_cli.__version__ import (
39
+ __version__ as __version__,
40
+ )
41
+ from pact_cli.__version__ import (
42
+ __version_tuple__ as __version_tuple__,
43
+ )
44
+
45
+ if TYPE_CHECKING:
46
+ from collections.abc import Mapping
47
+
48
+ _USE_SYSTEM_BINS = os.getenv("PACT_USE_SYSTEM_BINS", "").upper() in ("TRUE", "YES")
49
+ _BIN_DIR = Path(__file__).parent.resolve() / "bin"
50
+ _DEPRECATED_COMMANDS: Mapping[str, str | None] = {
51
+ "pact-broker": "pact broker",
52
+ "pact-message": None, # being removed; no Rust equivalent
53
+ "pact-mock-service": "pact mock",
54
+ "pact-plugin-cli": "pact plugin",
55
+ "pact-provider-verifier": "pact verifier",
56
+ "pact-stub-server": "pact stub",
57
+ "pact-stub-service": "pact stub",
58
+ "pact_mock_server_cli": "pact mock",
59
+ "pact_verifier_cli": "pact verifier",
60
+ "pactflow": "pact pactflow",
61
+ }
62
+
63
+
64
+ def _telemetry_env() -> Mapping[str, str]:
65
+ """
66
+ Get environment variables with Pact telemetry data.
67
+
68
+ Returns a copy of the current environment with the following two keys added:
69
+
70
+ - `PACT_EXECUTING_LANGUAGE`: Set to "python".
71
+ - `PACT_EXECUTING_LANGUAGE_VERSION`: Set to the current Python version
72
+ in "major.minor" format.
73
+
74
+ Returns:
75
+ Environment dictionary Pact telemetry added.
76
+ """
77
+ env = os.environ.copy()
78
+ env["PACT_EXECUTING_LANGUAGE"] = "python"
79
+ version = f"{sys.version_info.major}.{sys.version_info.minor}"
80
+ env["PACT_EXECUTING_LANGUAGE_VERSION"] = version
81
+ return env
82
+
83
+
84
+ def _exec() -> None:
85
+ """
86
+ Execute Pact CLI tools routed through the generated entry points.
87
+
88
+ This function is exposed via `pyproject.toml` console scripts and forwards
89
+ the provided command-line arguments to the matching Pact CLI binary.
90
+
91
+ Raises:
92
+ SystemExit:
93
+ If the requested command is unknown or an executable cannot be
94
+ located.
95
+ """
96
+ import sys # noqa: PLC0415
97
+
98
+ command = Path(sys.argv[0]).name
99
+ args = sys.argv[1:] if len(sys.argv) > 1 else []
100
+
101
+ if command not in (
102
+ "pact",
103
+ "pact-broker",
104
+ "pact-message",
105
+ "pact-mock-service",
106
+ "pact-plugin-cli",
107
+ "pact-provider-verifier",
108
+ "pact-stub-server",
109
+ "pact-stub-service",
110
+ "pact_mock_server_cli",
111
+ "pact_verifier_cli",
112
+ "pactflow",
113
+ ):
114
+ print("Unknown command:", command, file=sys.stderr) # noqa: T201
115
+ sys.exit(1)
116
+
117
+ if command in _DEPRECATED_COMMANDS:
118
+ replacement = _DEPRECATED_COMMANDS[command]
119
+ if replacement:
120
+ print( # noqa: T201
121
+ f"WARNING: '{command}' is deprecated and will be removed in a "
122
+ f"future release. Use '{replacement}' instead.\n",
123
+ file=sys.stderr,
124
+ flush=True,
125
+ )
126
+ else:
127
+ print( # noqa: T201
128
+ f"WARNING: '{command}' is deprecated and will be removed in a "
129
+ "future release.\n",
130
+ file=sys.stderr,
131
+ flush=True,
132
+ )
133
+
134
+ # To avoid finding the same executable, remove the current entry point's
135
+ # directory from PATH before searching.
136
+ script_dir = Path(sys.argv[0]).parent.resolve()
137
+ os.environ["PATH"] = os.pathsep.join(
138
+ p
139
+ for p in os.getenv("PATH", "").split(os.pathsep)
140
+ if Path(p).resolve() != script_dir
141
+ )
142
+ executable = _find_executable(command)
143
+
144
+ if not executable:
145
+ print(f"Command '{command}' not found.", file=sys.stderr) # noqa: T201
146
+ sys.exit(1)
147
+
148
+ os.execve(executable, [executable, *args], _telemetry_env()) # noqa: S606
149
+
150
+
151
+ def _find_executable(executable: str) -> str | None:
152
+ """
153
+ Find the path to an executable.
154
+
155
+ This inspects the environment variable `PACT_USE_SYSTEM_BINS` to determine
156
+ whether to use the bundled Pact binaries or the system ones. Note that if
157
+ the local executables are not found, this will fall back to the system
158
+ executables (if found).
159
+
160
+ Args:
161
+ executable:
162
+ The name of the executable to find without the extension. Python
163
+ will automatically append the correct extension for the current
164
+ platform.
165
+
166
+ Returns:
167
+ The absolute path to the executable.
168
+
169
+ Warns:
170
+ RuntimeWarning:
171
+ If the executable cannot be found in the system path.
172
+ """
173
+ if _USE_SYSTEM_BINS:
174
+ bin_path = shutil.which(executable)
175
+ else:
176
+ bin_path = shutil.which(executable, path=str(_BIN_DIR))
177
+ if bin_path is None:
178
+ system_path = shutil.which(executable)
179
+ if system_path is not None:
180
+ warnings.warn(
181
+ f"Bundled {executable} binary not found; "
182
+ "using system installation instead.",
183
+ RuntimeWarning,
184
+ stacklevel=2,
185
+ )
186
+ bin_path = system_path
187
+ if bin_path is None:
188
+ msg = f"Unable to find {executable} binary executable."
189
+ warnings.warn(msg, RuntimeWarning, stacklevel=2)
190
+ return bin_path
191
+
192
+
193
+ PACT_PATH = _find_executable("pact")
194
+ """
195
+ Path to the Pact executable
196
+ """
197
+ BROKER_PATH = _find_executable("pact-broker")
198
+ """
199
+ Path to the Pact Broker executable
200
+ """
201
+ BROKER_CLIENT_PATH = _find_executable("pact-broker")
202
+ """
203
+ Path to the Pact Broker executable
204
+
205
+ This value is identical to `BROKER_PATH` and is provided for backward
206
+ compatibility.
207
+ """
208
+ MESSAGE_PATH = _find_executable("pact-message")
209
+ """
210
+ Path to the Pact Message executable
211
+ """
212
+ MOCK_SERVICE_PATH = _find_executable("pact-mock-service")
213
+ """
214
+ Path to the Pact Mock Service executable
215
+ """
216
+ PLUGIN_CLI_PATH = _find_executable("pact-plugin-cli")
217
+ """
218
+ Path to the Pact Plugin CLI executable
219
+ """
220
+ VERIFIER_PATH = _find_executable("pact-provider-verifier")
221
+ """
222
+ Path to the Pact Provider Verifier executable
223
+ """
224
+ STUB_SERVER_PATH = _find_executable("pact-stub-server")
225
+ """
226
+ Path to the Pact Stub Server executable
227
+ """
228
+ STUB_SERVICE_PATH = _find_executable("pact-stub-service")
229
+ """
230
+ Path to the Pact Stub Service executable
231
+ """
232
+ MOCK_SERVER_PATH = _find_executable("pact_mock_server_cli")
233
+ """
234
+ Path to the Pact Mock Server CLI executable
235
+ """
236
+ VERIFIER_CLI_PATH = _find_executable("pact_verifier_cli")
237
+ """
238
+ Path to the Pact Verifier CLI executable
239
+
240
+ This is distinct to the `VERIFIER_PATH` which points to the older Ruby-based
241
+ CLI.
242
+ """
243
+ PACTFLOW_PATH = _find_executable("pactflow")
244
+ """
245
+ Path to the PactFlow CLI executable
246
+ """
@@ -0,0 +1,10 @@
1
+ """Version information for pact-python-cli."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("pact-python-cli")
7
+ except PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+ __version_tuple__ = tuple(int(x) for x in __version__.split(".") if x.isdigit())
pact_cli/bin/pact.exe ADDED
Binary file
pact_cli/py.typed ADDED
File without changes
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: pact-python-cli
3
+ Version: 2.6.0.0
4
+ Summary: Pact CLI bundle for Python
5
+ Project-URL: Bug Tracker, https://github.com/pact-foundation/pact-python/issues
6
+ Project-URL: Changelog, https://github.com/pact-foundation/pact-python/blob/main/pact-python-cli/CHANGELOG.md
7
+ Project-URL: Documentation, https://docs.pact.io
8
+ Project-URL: Homepage, https://pact.io
9
+ Project-URL: Repository, https://github.com/pact-foundation/pact-python
10
+ Author-email: Joshua Ellis <josh@jpellis.me>
11
+ Maintainer-email: Joshua Ellis <josh@jpellis.me>
12
+ License-Expression: MIT
13
+ License-File: LICENSE
14
+ Keywords: cli,contract-testing,pact,pact-python
15
+ Classifier: Development Status :: 5 - Production/Stable
16
+ Classifier: Environment :: Console
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: MacOS :: MacOS X
20
+ Classifier: Operating System :: Microsoft :: Windows
21
+ Classifier: Operating System :: POSIX :: Linux
22
+ Classifier: Programming Language :: Python
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: 3.14
29
+ Classifier: Topic :: Software Development :: Testing
30
+ Requires-Python: >=3.10
31
+ Description-Content-Type: text/markdown
32
+
33
+
34
+ # Pact Python CLI
35
+
36
+ > [!NOTE]
37
+ >
38
+ > This package is used to package and bundle the Pact CLI _only_. It does not provide any Python functionality or API.
39
+
40
+ <!-- markdownlint-disable no-inline-html -->
41
+ <div align="center"><table>
42
+ <tr>
43
+ <td>Package</td>
44
+ <td>
45
+ <a href="https://pypi.python.org/pypi/pact-python-cli"><img src="https://img.shields.io/pypi/v/pact-python-cli.svg" alt="Version"></a>
46
+ <a href="https://pypi.python.org/pypi/pact-python-cli"><img src="https://img.shields.io/pypi/pyversions/pact-python-cli.svg" alt="Python Versions"></a>
47
+ <a href="https://pypi.python.org/pypi/pact-python-cli"><img src="https://img.shields.io/pypi/dm/pact-python-cli.svg" alt="Downloads"></a>
48
+ </td>
49
+ </tr>
50
+ <tr>
51
+ <td>CI/CD</td>
52
+ <td>
53
+ <a
54
+ href="https://github.com/pact-foundation/pact-python/actions/workflows/test.yml?query=branch:main"><img
55
+ src="https://img.shields.io/github/actions/workflow/status/pact-foundation/pact-python/test.yml?branch=main&label=test"
56
+ alt="Test Status"></a>
57
+ <a
58
+ href="https://github.com/pact-foundation/pact-python/actions/workflows/build-cli.yml?query=branch:main"><img
59
+ src="https://img.shields.io/github/actions/workflow/status/pact-foundation/pact-python/build-cli.yml?branch=main&label=build"
60
+ alt="Build Status"></a>
61
+ <a
62
+ href="https://github.com/pact-foundation/pact-python/actions/workflows/docs.yml?query=branch:main"><img
63
+ src="https://img.shields.io/github/actions/workflow/status/pact-foundation/pact-python/docs.yml?branch=main&label=docs"
64
+ alt="Build Status"></a>
65
+ </td>
66
+ </tr>
67
+ <tr>
68
+ <td>Meta</td>
69
+ <td>
70
+ <a
71
+ href="https://github.com/pypa/hatch"><img
72
+ src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg"
73
+ alt="Hatch project"></a>
74
+ <a href="https://github.com/astral-sh/ruff"><img
75
+ src="https://img.shields.io/badge/ruff-ruff?label=linting&color=%23261230"
76
+ alt="linting - Ruff"></a>
77
+ <a href="https://github.com/astral-sh/ruff"><img
78
+ src="https://img.shields.io/badge/ruff-ruff?label=style&color=%23261230"
79
+ alt="style - Ruff"></a>
80
+ <a
81
+ href="https://github.com/python/mypy"><img
82
+ src="https://img.shields.io/badge/types-Mypy-blue.svg"
83
+ alt="types - Mypy"></a>
84
+ <a
85
+ href="https://pypi.python.org/pypi/pact-python-cli"><img
86
+ src="https://img.shields.io/pypi/l/pact-python-cli.svg"
87
+ alt="License"></a>
88
+ </td>
89
+ </tr>
90
+ <tr>
91
+ <td>Community</td>
92
+ <td>
93
+ <a
94
+ href="https://github.com/pact-foundation/pact-python/issues"><img
95
+ src="https://img.shields.io/github/issues/pact-foundation/pact-python.svg"
96
+ alt="Issues"></a>
97
+ <a
98
+ href="https://github.com/pact-foundation/pact-python/discussions"><img
99
+ src="https://img.shields.io/github/discussions/pact-foundation/pact-python.svg"
100
+ alt="Discussions"></a>
101
+ <a
102
+ href="https://github.com/pact-foundation/pact-python"><img
103
+ src="https://img.shields.io/github/stars/pact-foundation/pact-python.svg?style=flat"
104
+ alt="GitHub Stars"></a>
105
+ <br/>
106
+ <a
107
+ href="http://slack.pact.io"><img
108
+ src="https://img.shields.io/badge/slack-pact--foundation-4A154B.svg"
109
+ alt="Slack"></a>
110
+ <a
111
+ href="https://stackoverflow.com/questions/tagged/pact"><img
112
+ src="https://img.shields.io/badge/stackoverflow-pact-F48024.svg"
113
+ alt="Stack Overflow"></a>
114
+ <a
115
+ href="https://twitter.com/pact_up"><img
116
+ src="https://img.shields.io/badge/X-@pact__up-black.svg"
117
+ alt="Twitter"></a>
118
+ </td>
119
+ </tr>
120
+ </table></div>
121
+ <!-- markdownlint-enable no-inline-html -->
122
+
123
+ ---
124
+
125
+ This sub-package is part of the [Pact Python](https://github.com/pact-foundation/pact-python) project and exists solely to distribute the [Pact CLI](https://github.com/pact-foundation/pact-standalone) as a Python package. If you are looking for the main Pact Python library for contract testing, please see the [root package](https://github.com/pact-foundation/pact-python#pact-python).
126
+
127
+ It is used by version 2 of Pact Python, and can be used to install the Pact CLI in Python environments.
128
+
129
+ The versionining of `pact-python-cli` is aligned with the Pact CLI versioning. For example, version `2.4.26.2` corresponds to Pact CLI version `2.4.26`, with the `.2` indicating that this is the third release of that Pact CLI version in the Python package (with the first release being `.0`).
130
+
131
+ ## Installation
132
+
133
+ You can install this package via pip:
134
+
135
+ ```console
136
+ pip install pact-python-cli
137
+ ```
138
+
139
+ ## Contributing
140
+
141
+ Contributions to this package are generally not required as it contains minimal Python functionality and generally only requires updating the version number. This is done by pushing a tag of the form `pact-python-cli/<version>` which will automatically trigger a release build in the CI pipeline.
142
+
143
+ To contribute to the Pact CLI itself, please refer to the [Pact Ruby Standalone repository](https://github.com/pact-foundation/pact-standalone).
144
+
145
+ For contributing to Pact Python, see the [main contributing guide](https://github.com/pact-foundation/pact-python/blob/main/CONTRIBUTING.md).
146
+
147
+ ---
148
+
149
+ For questions or support, please visit the [Pact Foundation Slack](https://slack.pact.io) or [GitHub Discussions](https://github.com/pact-foundation/pact-python/discussions).
150
+
151
+ ---
@@ -0,0 +1,10 @@
1
+ pact_cli/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ pact_cli/__init__.py,sha256=4zpYaXx2iozStD6pMVKXO4aNKt2A05WAQMqPNlEvBak,7939
3
+ pact_cli/__version__.py,sha256=mSzUTJdZnBqA83odfLyJXs72nLg7UKIsowp12hx2lyA,309
4
+ pact_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ pact_cli/bin/pact.exe,sha256=nGMNTrap1VrGqSYs5jxCOJob_rNEUzMt5V_KjHwiV8c,9920512
6
+ pact_python_cli-2.6.0.0.dist-info/METADATA,sha256=U95teJsO4XpWEZYN9i6Yj_DqbG7opdqUiI1NAbPBq1k,7335
7
+ pact_python_cli-2.6.0.0.dist-info/WHEEL,sha256=rYzjjqDxNfVoaAzib_XKsKilV1MJuYNAv8Q2Faxx1ys,93
8
+ pact_python_cli-2.6.0.0.dist-info/entry_points.txt,sha256=utvyeaJBkfSBeNzomnnAD603lsoeRV5_NrIpgfoUtIM,375
9
+ pact_python_cli-2.6.0.0.dist-info/licenses/LICENSE,sha256=RMcvx3YlJ7ZFfF7np7LAs4yo6C7oht1ZJywBn1Mxz7g,1093
10
+ pact_python_cli-2.6.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-win_arm64
@@ -0,0 +1,12 @@
1
+ [console_scripts]
2
+ pact = pact_cli:_exec
3
+ pact-broker = pact_cli:_exec
4
+ pact-message = pact_cli:_exec
5
+ pact-mock-service = pact_cli:_exec
6
+ pact-plugin-cli = pact_cli:_exec
7
+ pact-provider-verifier = pact_cli:_exec
8
+ pact-stub-server = pact_cli:_exec
9
+ pact-stub-service = pact_cli:_exec
10
+ pact_mock_server_cli = pact_cli:_exec
11
+ pact_verifier_cli = pact_cli:_exec
12
+ pactflow = pact_cli:_exec
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pact Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.