pact-python-cli 0.0.0__tar.gz → 2.5.7.0__tar.gz
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_python_cli-2.5.7.0/.gitignore +4 -0
- pact_python_cli-2.5.7.0/LICENSE +21 -0
- pact_python_cli-2.5.7.0/PKG-INFO +151 -0
- pact_python_cli-2.5.7.0/README.md +119 -0
- pact_python_cli-2.5.7.0/hatch_build.py +272 -0
- pact_python_cli-2.5.7.0/pact_cli/.gitkeep +0 -0
- pact_python_cli-2.5.7.0/pact_cli/__init__.py +235 -0
- pact_python_cli-2.5.7.0/pact_cli/__version__.py +6 -0
- pact_python_cli-2.5.7.0/pact_cli/py.typed +0 -0
- pact_python_cli-2.5.7.0/pyproject.toml +202 -0
- pact_python_cli-0.0.0/PKG-INFO +0 -7
- pact_python_cli-0.0.0/pact_python_cli.egg-info/PKG-INFO +0 -7
- pact_python_cli-0.0.0/pact_python_cli.egg-info/SOURCES.txt +0 -5
- pact_python_cli-0.0.0/pact_python_cli.egg-info/dependency_links.txt +0 -1
- pact_python_cli-0.0.0/pact_python_cli.egg-info/top_level.txt +0 -1
- pact_python_cli-0.0.0/pyproject.toml +0 -10
- pact_python_cli-0.0.0/setup.cfg +0 -4
|
@@ -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.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pact-python-cli
|
|
3
|
+
Version: 2.5.7.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,119 @@
|
|
|
1
|
+
|
|
2
|
+
# Pact Python CLI
|
|
3
|
+
|
|
4
|
+
> [!NOTE]
|
|
5
|
+
>
|
|
6
|
+
> This package is used to package and bundle the Pact CLI _only_. It does not provide any Python functionality or API.
|
|
7
|
+
|
|
8
|
+
<!-- markdownlint-disable no-inline-html -->
|
|
9
|
+
<div align="center"><table>
|
|
10
|
+
<tr>
|
|
11
|
+
<td>Package</td>
|
|
12
|
+
<td>
|
|
13
|
+
<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>
|
|
14
|
+
<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>
|
|
15
|
+
<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>
|
|
16
|
+
</td>
|
|
17
|
+
</tr>
|
|
18
|
+
<tr>
|
|
19
|
+
<td>CI/CD</td>
|
|
20
|
+
<td>
|
|
21
|
+
<a
|
|
22
|
+
href="https://github.com/pact-foundation/pact-python/actions/workflows/test.yml?query=branch:main"><img
|
|
23
|
+
src="https://img.shields.io/github/actions/workflow/status/pact-foundation/pact-python/test.yml?branch=main&label=test"
|
|
24
|
+
alt="Test Status"></a>
|
|
25
|
+
<a
|
|
26
|
+
href="https://github.com/pact-foundation/pact-python/actions/workflows/build-cli.yml?query=branch:main"><img
|
|
27
|
+
src="https://img.shields.io/github/actions/workflow/status/pact-foundation/pact-python/build-cli.yml?branch=main&label=build"
|
|
28
|
+
alt="Build Status"></a>
|
|
29
|
+
<a
|
|
30
|
+
href="https://github.com/pact-foundation/pact-python/actions/workflows/docs.yml?query=branch:main"><img
|
|
31
|
+
src="https://img.shields.io/github/actions/workflow/status/pact-foundation/pact-python/docs.yml?branch=main&label=docs"
|
|
32
|
+
alt="Build Status"></a>
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
<tr>
|
|
36
|
+
<td>Meta</td>
|
|
37
|
+
<td>
|
|
38
|
+
<a
|
|
39
|
+
href="https://github.com/pypa/hatch"><img
|
|
40
|
+
src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg"
|
|
41
|
+
alt="Hatch project"></a>
|
|
42
|
+
<a href="https://github.com/astral-sh/ruff"><img
|
|
43
|
+
src="https://img.shields.io/badge/ruff-ruff?label=linting&color=%23261230"
|
|
44
|
+
alt="linting - Ruff"></a>
|
|
45
|
+
<a href="https://github.com/astral-sh/ruff"><img
|
|
46
|
+
src="https://img.shields.io/badge/ruff-ruff?label=style&color=%23261230"
|
|
47
|
+
alt="style - Ruff"></a>
|
|
48
|
+
<a
|
|
49
|
+
href="https://github.com/python/mypy"><img
|
|
50
|
+
src="https://img.shields.io/badge/types-Mypy-blue.svg"
|
|
51
|
+
alt="types - Mypy"></a>
|
|
52
|
+
<a
|
|
53
|
+
href="https://pypi.python.org/pypi/pact-python-cli"><img
|
|
54
|
+
src="https://img.shields.io/pypi/l/pact-python-cli.svg"
|
|
55
|
+
alt="License"></a>
|
|
56
|
+
</td>
|
|
57
|
+
</tr>
|
|
58
|
+
<tr>
|
|
59
|
+
<td>Community</td>
|
|
60
|
+
<td>
|
|
61
|
+
<a
|
|
62
|
+
href="https://github.com/pact-foundation/pact-python/issues"><img
|
|
63
|
+
src="https://img.shields.io/github/issues/pact-foundation/pact-python.svg"
|
|
64
|
+
alt="Issues"></a>
|
|
65
|
+
<a
|
|
66
|
+
href="https://github.com/pact-foundation/pact-python/discussions"><img
|
|
67
|
+
src="https://img.shields.io/github/discussions/pact-foundation/pact-python.svg"
|
|
68
|
+
alt="Discussions"></a>
|
|
69
|
+
<a
|
|
70
|
+
href="https://github.com/pact-foundation/pact-python"><img
|
|
71
|
+
src="https://img.shields.io/github/stars/pact-foundation/pact-python.svg?style=flat"
|
|
72
|
+
alt="GitHub Stars"></a>
|
|
73
|
+
<br/>
|
|
74
|
+
<a
|
|
75
|
+
href="http://slack.pact.io"><img
|
|
76
|
+
src="https://img.shields.io/badge/slack-pact--foundation-4A154B.svg"
|
|
77
|
+
alt="Slack"></a>
|
|
78
|
+
<a
|
|
79
|
+
href="https://stackoverflow.com/questions/tagged/pact"><img
|
|
80
|
+
src="https://img.shields.io/badge/stackoverflow-pact-F48024.svg"
|
|
81
|
+
alt="Stack Overflow"></a>
|
|
82
|
+
<a
|
|
83
|
+
href="https://twitter.com/pact_up"><img
|
|
84
|
+
src="https://img.shields.io/badge/X-@pact__up-black.svg"
|
|
85
|
+
alt="Twitter"></a>
|
|
86
|
+
</td>
|
|
87
|
+
</tr>
|
|
88
|
+
</table></div>
|
|
89
|
+
<!-- markdownlint-enable no-inline-html -->
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
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).
|
|
94
|
+
|
|
95
|
+
It is used by version 2 of Pact Python, and can be used to install the Pact CLI in Python environments.
|
|
96
|
+
|
|
97
|
+
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`).
|
|
98
|
+
|
|
99
|
+
## Installation
|
|
100
|
+
|
|
101
|
+
You can install this package via pip:
|
|
102
|
+
|
|
103
|
+
```console
|
|
104
|
+
pip install pact-python-cli
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Contributing
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
To contribute to the Pact CLI itself, please refer to the [Pact Ruby Standalone repository](https://github.com/pact-foundation/pact-standalone).
|
|
112
|
+
|
|
113
|
+
For contributing to Pact Python, see the [main contributing guide](https://github.com/pact-foundation/pact-python/blob/main/CONTRIBUTING.md).
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
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).
|
|
118
|
+
|
|
119
|
+
---
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Hatchling build hook.
|
|
3
|
+
|
|
4
|
+
This hook is responsible for downloading and packaging the Pact CLI.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
import shutil
|
|
11
|
+
import sys
|
|
12
|
+
import tarfile
|
|
13
|
+
import tempfile
|
|
14
|
+
import urllib.request
|
|
15
|
+
import zipfile
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import TYPE_CHECKING, Any
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from collections.abc import Mapping, MutableMapping, Sequence
|
|
21
|
+
|
|
22
|
+
from hatchling.builders.config import BuilderConfig
|
|
23
|
+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
|
24
|
+
from packaging.tags import sys_tags
|
|
25
|
+
|
|
26
|
+
PKG_DIR = Path(__file__).parent.resolve() / "src" / "pact_cli"
|
|
27
|
+
PACT_CLI_URL = "https://github.com/pact-foundation/pact-standalone/releases/download/v{version}/pact-{version}-{os}-{machine}.{ext}"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class UnsupportedPlatformError(RuntimeError):
|
|
31
|
+
"""
|
|
32
|
+
Custom error raised when the current platform is not supported.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def __init__(self, platform: str) -> None:
|
|
36
|
+
"""
|
|
37
|
+
Initialize the exception.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
platform:
|
|
41
|
+
The unsupported platform.
|
|
42
|
+
"""
|
|
43
|
+
self.platform = platform
|
|
44
|
+
super().__init__(f"Unsupported platform {platform}")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class PactCliBuildHook(BuildHookInterface[BuilderConfig]):
|
|
48
|
+
"""
|
|
49
|
+
Custom hook to download Pact CLI binaries.
|
|
50
|
+
|
|
51
|
+
This build hook is invoked by Hatch during the build process. Within
|
|
52
|
+
`pyproject.toml`, it takes the special name of `custom` (despite the name
|
|
53
|
+
below).
|
|
54
|
+
|
|
55
|
+
For more references, see [Build hook
|
|
56
|
+
plugins](https://hatch.pypa.io/1.3/plugins/build-hook/reference/).
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
PLUGIN_NAME = "pact-cli"
|
|
60
|
+
|
|
61
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None: # noqa: ANN401
|
|
62
|
+
"""
|
|
63
|
+
Initialize the build hook.
|
|
64
|
+
|
|
65
|
+
For this hook, we additionally define the lib extension based on the
|
|
66
|
+
current platform.
|
|
67
|
+
"""
|
|
68
|
+
super().__init__(*args, **kwargs)
|
|
69
|
+
self.tmpdir = Path(tempfile.TemporaryDirectory().name)
|
|
70
|
+
self.tmpdir.mkdir(parents=True, exist_ok=True)
|
|
71
|
+
|
|
72
|
+
def __del__(self) -> None:
|
|
73
|
+
"""
|
|
74
|
+
Clean up temporary files.
|
|
75
|
+
"""
|
|
76
|
+
shutil.rmtree(self.tmpdir, ignore_errors=True)
|
|
77
|
+
|
|
78
|
+
def clean(self, versions: Sequence[str]) -> None: # noqa: ARG002
|
|
79
|
+
"""
|
|
80
|
+
Code called to clean.
|
|
81
|
+
|
|
82
|
+
This is called by `hatch clean` or when the `-c`/`--clean` flag is
|
|
83
|
+
passed to `hatch build`.
|
|
84
|
+
"""
|
|
85
|
+
for subdir in ["bin", "lib", "data"]:
|
|
86
|
+
shutil.rmtree(PKG_DIR / subdir, ignore_errors=True)
|
|
87
|
+
|
|
88
|
+
def initialize(
|
|
89
|
+
self,
|
|
90
|
+
version: str, # noqa: ARG002
|
|
91
|
+
build_data: MutableMapping[str, object],
|
|
92
|
+
) -> None:
|
|
93
|
+
"""
|
|
94
|
+
Code called immediately before each build.
|
|
95
|
+
|
|
96
|
+
The CLI version is inferred from the package metadata. Specifically, the
|
|
97
|
+
first three segments of the version string are used.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
version:
|
|
101
|
+
Not used (but required by the parent class).
|
|
102
|
+
|
|
103
|
+
build_data:
|
|
104
|
+
A mutable mapping to modify in-place used by Hatch when creating
|
|
105
|
+
the final wheel.
|
|
106
|
+
|
|
107
|
+
Raises:
|
|
108
|
+
UnsupportedPlatformError:
|
|
109
|
+
If the CLI cannot be built (presumably due to an
|
|
110
|
+
incompatible platform).
|
|
111
|
+
"""
|
|
112
|
+
cli_version = ".".join(self.metadata.version.split(".")[:3])
|
|
113
|
+
if not cli_version:
|
|
114
|
+
msg = "Failed to determine Pact CLI version."
|
|
115
|
+
self.app.display_error(msg)
|
|
116
|
+
raise ValueError(msg)
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
build_data["force_include"] = self._install(cli_version)
|
|
120
|
+
except UnsupportedPlatformError as err:
|
|
121
|
+
msg = f"Pact CLI is not available for {err.platform}."
|
|
122
|
+
self.app.display_error(msg)
|
|
123
|
+
raise
|
|
124
|
+
|
|
125
|
+
build_data["tag"] = self._infer_tag()
|
|
126
|
+
|
|
127
|
+
def _sys_tag_platform(self) -> str:
|
|
128
|
+
"""
|
|
129
|
+
Get the platform tag from the current system tags.
|
|
130
|
+
|
|
131
|
+
This is used to determine the target platform for the Pact binaries.
|
|
132
|
+
"""
|
|
133
|
+
return next(t.platform for t in sys_tags())
|
|
134
|
+
|
|
135
|
+
def _install(self, version: str) -> Mapping[str, str]:
|
|
136
|
+
"""
|
|
137
|
+
Install the Pact standalone binaries.
|
|
138
|
+
|
|
139
|
+
The binaries are installed in `src/pact_cli/bin`, and the relevant
|
|
140
|
+
version for the current operating system is determined automatically.
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
version:
|
|
144
|
+
The Pact CLI version to install.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
A mapping of `src` to `dst` to be used by Hatch when creating the
|
|
148
|
+
wheel. Each `src` is a full path in the current filesystem, and the
|
|
149
|
+
`dst` is the corresponding path within the wheel.
|
|
150
|
+
"""
|
|
151
|
+
url = self._pact_bin_url(version)
|
|
152
|
+
artefact = self._download(url)
|
|
153
|
+
self._extract(artefact)
|
|
154
|
+
return {
|
|
155
|
+
str(PKG_DIR / "bin"): "pact_cli/bin",
|
|
156
|
+
str(PKG_DIR / "lib"): "pact_cli/lib",
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
def _pact_bin_url(self, version: str) -> str:
|
|
160
|
+
"""
|
|
161
|
+
Generate the download URL for the Pact binaries.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
version:
|
|
165
|
+
The Pact CLI version to download.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
The URL to download the Pact binaries from. If the platform is not
|
|
169
|
+
supported, the resulting URL may be invalid.
|
|
170
|
+
"""
|
|
171
|
+
platform = self._sys_tag_platform()
|
|
172
|
+
|
|
173
|
+
if platform.startswith("macosx"):
|
|
174
|
+
os_name = "osx"
|
|
175
|
+
ext = "tar.gz"
|
|
176
|
+
elif "linux" in platform:
|
|
177
|
+
os_name = "linux"
|
|
178
|
+
ext = "tar.gz"
|
|
179
|
+
elif platform.startswith("win"):
|
|
180
|
+
os_name = "windows"
|
|
181
|
+
ext = "zip"
|
|
182
|
+
else:
|
|
183
|
+
raise UnsupportedPlatformError(platform)
|
|
184
|
+
|
|
185
|
+
if platform.endswith(("arm64", "aarch64")):
|
|
186
|
+
machine = "arm64"
|
|
187
|
+
elif platform.endswith(("x86_64", "amd64")):
|
|
188
|
+
machine = "x86_64"
|
|
189
|
+
else:
|
|
190
|
+
raise UnsupportedPlatformError(platform)
|
|
191
|
+
|
|
192
|
+
return PACT_CLI_URL.format(
|
|
193
|
+
version=version,
|
|
194
|
+
os=os_name,
|
|
195
|
+
machine=machine,
|
|
196
|
+
ext=ext,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
def _extract(self, artefact: Path) -> None:
|
|
200
|
+
"""
|
|
201
|
+
Extract the Pact binaries.
|
|
202
|
+
|
|
203
|
+
The binaries in the `bin` directory require the underlying Ruby runtime
|
|
204
|
+
to be present, which is included in the `lib` directory.
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
artefact:
|
|
208
|
+
The path to the downloaded artefact.
|
|
209
|
+
"""
|
|
210
|
+
if str(artefact).endswith(".zip"):
|
|
211
|
+
with zipfile.ZipFile(artefact) as f:
|
|
212
|
+
f.extractall(self.tmpdir) # noqa: S202
|
|
213
|
+
|
|
214
|
+
if str(artefact).endswith(".tar.gz"):
|
|
215
|
+
with tarfile.open(artefact) as f:
|
|
216
|
+
f.extractall(self.tmpdir) # noqa: S202
|
|
217
|
+
|
|
218
|
+
for d in ["bin", "lib"]:
|
|
219
|
+
if (PKG_DIR / d).is_dir():
|
|
220
|
+
shutil.rmtree(PKG_DIR / d)
|
|
221
|
+
shutil.copytree(
|
|
222
|
+
Path(self.tmpdir) / "pact" / d,
|
|
223
|
+
PKG_DIR / d,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
def _download(self, url: str) -> Path:
|
|
227
|
+
"""
|
|
228
|
+
Download the target URL.
|
|
229
|
+
|
|
230
|
+
This will download the target URL to the `src/pact_cli/data` directory.
|
|
231
|
+
If the download artefact is already present, the existing artefact's
|
|
232
|
+
path will be returned without downloading it again.
|
|
233
|
+
|
|
234
|
+
Args:
|
|
235
|
+
url:
|
|
236
|
+
The URL to download
|
|
237
|
+
|
|
238
|
+
Returns:
|
|
239
|
+
The path to the downloaded artefact.
|
|
240
|
+
"""
|
|
241
|
+
filename = url.split("/")[-1]
|
|
242
|
+
artefact = PKG_DIR / "data" / filename
|
|
243
|
+
artefact.parent.mkdir(parents=True, exist_ok=True)
|
|
244
|
+
|
|
245
|
+
if not artefact.exists():
|
|
246
|
+
urllib.request.urlretrieve(url, artefact) # noqa: S310
|
|
247
|
+
return artefact
|
|
248
|
+
|
|
249
|
+
def _infer_tag(self) -> str:
|
|
250
|
+
"""
|
|
251
|
+
Infer the tag for the current build.
|
|
252
|
+
|
|
253
|
+
Since we have a pure Python wrapper around a binary CLI, we are not
|
|
254
|
+
tied to any specific Python version or ABI. As a result, we generate
|
|
255
|
+
`py3-none-{platform}` tags for the wheels.
|
|
256
|
+
"""
|
|
257
|
+
platform = self._sys_tag_platform()
|
|
258
|
+
|
|
259
|
+
# On macOS, the version needs to be set based on the deployment target
|
|
260
|
+
# (i.e., the version of the system libraries).
|
|
261
|
+
if sys.platform == "darwin" and (
|
|
262
|
+
deployment_target := os.environ.get("MACOSX_DEPLOYMENT_TARGET")
|
|
263
|
+
):
|
|
264
|
+
target = deployment_target.replace(".", "_")
|
|
265
|
+
if platform.endswith("_arm64"):
|
|
266
|
+
platform = f"macosx_{target}_arm64"
|
|
267
|
+
elif platform.endswith("_x86_64"):
|
|
268
|
+
platform = f"macosx_{target}_x86_64"
|
|
269
|
+
else:
|
|
270
|
+
raise UnsupportedPlatformError(platform)
|
|
271
|
+
|
|
272
|
+
return f"py3-none-{platform}"
|
|
File without changes
|
|
@@ -0,0 +1,235 @@
|
|
|
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 Container, 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
|
+
_LEGACY_BINS: Container[str] = frozenset((
|
|
51
|
+
"pact-message",
|
|
52
|
+
"pact-mock-service",
|
|
53
|
+
"pact-provider-verifier",
|
|
54
|
+
"pact-stub-service",
|
|
55
|
+
))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _telemetry_env() -> Mapping[str, str]:
|
|
59
|
+
"""
|
|
60
|
+
Get environment variables with Pact telemetry data.
|
|
61
|
+
|
|
62
|
+
Returns a copy of the current environment with the following two keys added:
|
|
63
|
+
|
|
64
|
+
- `PACT_EXECUTING_LANGUAGE`: Set to "python".
|
|
65
|
+
- `PACT_EXECUTING_LANGUAGE_VERSION`: Set to the current Python version
|
|
66
|
+
in "major.minor" format.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
Environment dictionary Pact telemetry added.
|
|
70
|
+
"""
|
|
71
|
+
env = os.environ.copy()
|
|
72
|
+
env["PACT_EXECUTING_LANGUAGE"] = "python"
|
|
73
|
+
version = f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
74
|
+
env["PACT_EXECUTING_LANGUAGE_VERSION"] = version
|
|
75
|
+
return env
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _exec() -> None:
|
|
79
|
+
"""
|
|
80
|
+
Execute Pact CLI tools routed through the generated entry points.
|
|
81
|
+
|
|
82
|
+
This function is exposed via `pyproject.toml` console scripts and forwards
|
|
83
|
+
the provided command-line arguments to the matching Pact CLI binary.
|
|
84
|
+
|
|
85
|
+
Raises:
|
|
86
|
+
SystemExit:
|
|
87
|
+
If the requested command is unknown or an executable cannot be
|
|
88
|
+
located.
|
|
89
|
+
"""
|
|
90
|
+
import sys # noqa: PLC0415
|
|
91
|
+
|
|
92
|
+
command = Path(sys.argv[0]).name
|
|
93
|
+
args = sys.argv[1:] if len(sys.argv) > 1 else []
|
|
94
|
+
|
|
95
|
+
if command not in (
|
|
96
|
+
"pact",
|
|
97
|
+
"pact-broker",
|
|
98
|
+
"pact-message",
|
|
99
|
+
"pact-mock-service",
|
|
100
|
+
"pact-plugin-cli",
|
|
101
|
+
"pact-provider-verifier",
|
|
102
|
+
"pact-stub-server",
|
|
103
|
+
"pact-stub-service",
|
|
104
|
+
"pact_mock_server_cli",
|
|
105
|
+
"pact_verifier_cli",
|
|
106
|
+
"pactflow",
|
|
107
|
+
):
|
|
108
|
+
print("Unknown command:", command, file=sys.stderr) # noqa: T201
|
|
109
|
+
sys.exit(1)
|
|
110
|
+
|
|
111
|
+
if command in _LEGACY_BINS:
|
|
112
|
+
warnings.warn(
|
|
113
|
+
f"The '{command}' executable is deprecated and will be removed in "
|
|
114
|
+
"a future release. Please migrate to the new Pact CLI tools. "
|
|
115
|
+
"See: <https://github.com/pact-foundation/pact-standalone>",
|
|
116
|
+
DeprecationWarning,
|
|
117
|
+
stacklevel=2,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
if not _USE_SYSTEM_BINS:
|
|
121
|
+
executable = _find_executable(command)
|
|
122
|
+
else:
|
|
123
|
+
# To avoid finding the same executable, we have to process the PATH
|
|
124
|
+
# variable and remove the current executable's directory.
|
|
125
|
+
script_dir = Path(sys.argv[0]).parent.resolve()
|
|
126
|
+
os.environ["PATH"] = os.pathsep.join(
|
|
127
|
+
p
|
|
128
|
+
for p in os.getenv("PATH", "").split(os.pathsep)
|
|
129
|
+
if Path(p).resolve() != script_dir
|
|
130
|
+
)
|
|
131
|
+
executable = _find_executable(command)
|
|
132
|
+
|
|
133
|
+
if not executable:
|
|
134
|
+
print(f"Command '{command}' not found.", file=sys.stderr) # noqa: T201
|
|
135
|
+
sys.exit(1)
|
|
136
|
+
|
|
137
|
+
os.execve(executable, [executable, *args], _telemetry_env()) # noqa: S606
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _find_executable(executable: str) -> str | None:
|
|
141
|
+
"""
|
|
142
|
+
Find the path to an executable.
|
|
143
|
+
|
|
144
|
+
This inspects the environment variable `PACT_USE_SYSTEM_BINS` to determine
|
|
145
|
+
whether to use the bundled Pact binaries or the system ones. Note that if
|
|
146
|
+
the local executables are not found, this will fall back to the system
|
|
147
|
+
executables (if found).
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
executable:
|
|
151
|
+
The name of the executable to find without the extension. Python
|
|
152
|
+
will automatically append the correct extension for the current
|
|
153
|
+
platform.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
The absolute path to the executable.
|
|
157
|
+
|
|
158
|
+
Warns:
|
|
159
|
+
RuntimeWarning:
|
|
160
|
+
If the executable cannot be found in the system path.
|
|
161
|
+
"""
|
|
162
|
+
if _USE_SYSTEM_BINS:
|
|
163
|
+
bin_path = shutil.which(executable)
|
|
164
|
+
else:
|
|
165
|
+
bin_path = shutil.which(executable, path=str(_BIN_DIR))
|
|
166
|
+
if bin_path is None:
|
|
167
|
+
system_path = shutil.which(executable)
|
|
168
|
+
if system_path is not None:
|
|
169
|
+
warnings.warn(
|
|
170
|
+
f"Bundled {executable} binary not found; "
|
|
171
|
+
"using system installation instead.",
|
|
172
|
+
RuntimeWarning,
|
|
173
|
+
stacklevel=2,
|
|
174
|
+
)
|
|
175
|
+
bin_path = system_path
|
|
176
|
+
if bin_path is None:
|
|
177
|
+
msg = f"Unable to find {executable} binary executable."
|
|
178
|
+
warnings.warn(msg, RuntimeWarning, stacklevel=2)
|
|
179
|
+
return bin_path
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
PACT_PATH = _find_executable("pact")
|
|
183
|
+
"""
|
|
184
|
+
Path to the Pact executable
|
|
185
|
+
"""
|
|
186
|
+
BROKER_PATH = _find_executable("pact-broker")
|
|
187
|
+
"""
|
|
188
|
+
Path to the Pact Broker executable
|
|
189
|
+
"""
|
|
190
|
+
BROKER_CLIENT_PATH = _find_executable("pact-broker")
|
|
191
|
+
"""
|
|
192
|
+
Path to the Pact Broker executable
|
|
193
|
+
|
|
194
|
+
This value is identical to `BROKER_PATH` and is provided for backward
|
|
195
|
+
compatibility.
|
|
196
|
+
"""
|
|
197
|
+
MESSAGE_PATH = _find_executable("pact-message")
|
|
198
|
+
"""
|
|
199
|
+
Path to the Pact Message executable
|
|
200
|
+
"""
|
|
201
|
+
MOCK_SERVICE_PATH = _find_executable("pact-mock-service")
|
|
202
|
+
"""
|
|
203
|
+
Path to the Pact Mock Service executable
|
|
204
|
+
"""
|
|
205
|
+
PLUGIN_CLI_PATH = _find_executable("pact-plugin-cli")
|
|
206
|
+
"""
|
|
207
|
+
Path to the Pact Plugin CLI executable
|
|
208
|
+
"""
|
|
209
|
+
VERIFIER_PATH = _find_executable("pact-provider-verifier")
|
|
210
|
+
"""
|
|
211
|
+
Path to the Pact Provider Verifier executable
|
|
212
|
+
"""
|
|
213
|
+
STUB_SERVER_PATH = _find_executable("pact-stub-server")
|
|
214
|
+
"""
|
|
215
|
+
Path to the Pact Stub Server executable
|
|
216
|
+
"""
|
|
217
|
+
STUB_SERVICE_PATH = _find_executable("pact-stub-service")
|
|
218
|
+
"""
|
|
219
|
+
Path to the Pact Stub Service executable
|
|
220
|
+
"""
|
|
221
|
+
MOCK_SERVER_PATH = _find_executable("pact_mock_server_cli")
|
|
222
|
+
"""
|
|
223
|
+
Path to the Pact Mock Server CLI executable
|
|
224
|
+
"""
|
|
225
|
+
VERIFIER_CLI_PATH = _find_executable("pact_verifier_cli")
|
|
226
|
+
"""
|
|
227
|
+
Path to the Pact Verifier CLI executable
|
|
228
|
+
|
|
229
|
+
This is distinct to the `VERIFIER_PATH` which points to the older Ruby-based
|
|
230
|
+
CLI.
|
|
231
|
+
"""
|
|
232
|
+
PACTFLOW_PATH = _find_executable("pactflow")
|
|
233
|
+
"""
|
|
234
|
+
Path to the PactFlow CLI executable
|
|
235
|
+
"""
|
|
File without changes
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#:schema https://www.schemastore.org/pyproject.json
|
|
2
|
+
[project]
|
|
3
|
+
description = "Pact CLI bundle for Python"
|
|
4
|
+
name = "pact-python-cli"
|
|
5
|
+
|
|
6
|
+
dynamic = ["version"]
|
|
7
|
+
keywords = ["pact", "cli", "pact-python", "contract-testing"]
|
|
8
|
+
license = "MIT"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
|
|
11
|
+
authors = [{ name = "Joshua Ellis", email = "josh@jpellis.me" }]
|
|
12
|
+
maintainers = [{ name = "Joshua Ellis", email = "josh@jpellis.me" }]
|
|
13
|
+
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 5 - Production/Stable",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: MacOS :: MacOS X",
|
|
20
|
+
"Operating System :: Microsoft :: Windows",
|
|
21
|
+
"Operating System :: POSIX :: Linux",
|
|
22
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Programming Language :: Python",
|
|
29
|
+
"Topic :: Software Development :: Testing",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
requires-python = ">=3.10"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
"Bug Tracker" = "https://github.com/pact-foundation/pact-python/issues"
|
|
36
|
+
"Changelog" = "https://github.com/pact-foundation/pact-python/blob/main/pact-python-cli/CHANGELOG.md"
|
|
37
|
+
"Documentation" = "https://docs.pact.io"
|
|
38
|
+
"Homepage" = "https://pact.io"
|
|
39
|
+
"Repository" = "https://github.com/pact-foundation/pact-python"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
pact = "pact_cli:_exec"
|
|
43
|
+
pact-broker = "pact_cli:_exec"
|
|
44
|
+
pact-message = "pact_cli:_exec"
|
|
45
|
+
pact-mock-service = "pact_cli:_exec"
|
|
46
|
+
pact-plugin-cli = "pact_cli:_exec"
|
|
47
|
+
pact-provider-verifier = "pact_cli:_exec"
|
|
48
|
+
pact-stub-server = "pact_cli:_exec"
|
|
49
|
+
pact-stub-service = "pact_cli:_exec"
|
|
50
|
+
pact_mock_server_cli = "pact_cli:_exec"
|
|
51
|
+
pact_verifier_cli = "pact_cli:_exec"
|
|
52
|
+
pactflow = "pact_cli:_exec"
|
|
53
|
+
|
|
54
|
+
[dependency-groups]
|
|
55
|
+
# Linting and formatting tools use a more narrow specification to ensure
|
|
56
|
+
# developper consistency. All other dependencies are as above.
|
|
57
|
+
dev = ["ruff==0.14.8", { include-group = "test" }, { include-group = "types" }]
|
|
58
|
+
test = ["pytest-cov~=7.0", "pytest~=9.0"]
|
|
59
|
+
types = ["mypy==1.19.0"]
|
|
60
|
+
|
|
61
|
+
################################################################################
|
|
62
|
+
## Build System
|
|
63
|
+
################################################################################
|
|
64
|
+
[build-system]
|
|
65
|
+
build-backend = "hatchling.build"
|
|
66
|
+
requires = ["hatchling", "packaging", "versioningit"]
|
|
67
|
+
|
|
68
|
+
[tool.hatch]
|
|
69
|
+
|
|
70
|
+
[tool.hatch.version]
|
|
71
|
+
source = "versioningit"
|
|
72
|
+
|
|
73
|
+
[tool.hatch.build]
|
|
74
|
+
artifacts = ["src/pact_cli/__version__.py"]
|
|
75
|
+
packages = ["src/pact_cli"]
|
|
76
|
+
|
|
77
|
+
[tool.hatch.build.targets.wheel.hooks.custom]
|
|
78
|
+
patch = "hatch_build.py"
|
|
79
|
+
|
|
80
|
+
########################################
|
|
81
|
+
## Hatch Environment Configuration
|
|
82
|
+
########################################
|
|
83
|
+
[tool.hatch.envs]
|
|
84
|
+
|
|
85
|
+
# Install dev dependencies in the default environment to simplify the developer
|
|
86
|
+
# workflow.
|
|
87
|
+
[tool.hatch.envs.default]
|
|
88
|
+
extra-dependencies = [
|
|
89
|
+
"hatchling",
|
|
90
|
+
"packaging",
|
|
91
|
+
"requests",
|
|
92
|
+
"setuptools ; python_version >= '3.12'",
|
|
93
|
+
]
|
|
94
|
+
installer = "uv"
|
|
95
|
+
path = ".venv"
|
|
96
|
+
pre-install-commands = ["uv pip install --group dev -e ."]
|
|
97
|
+
|
|
98
|
+
[tool.hatch.envs.default.scripts]
|
|
99
|
+
all = ["format", "lint", "test", "typecheck"]
|
|
100
|
+
format = "ruff format {args}"
|
|
101
|
+
lint = "ruff check --show-fixes {args}"
|
|
102
|
+
test = "pytest tests/ {args}"
|
|
103
|
+
typecheck = ["typecheck-src", "typecheck-tests"]
|
|
104
|
+
typecheck-src = "mypy src/ {args}"
|
|
105
|
+
typecheck-tests = "mypy tests/ {args}"
|
|
106
|
+
|
|
107
|
+
# Test environment for running unit tests. This automatically tests against all
|
|
108
|
+
# supported Python versions.
|
|
109
|
+
[tool.hatch.envs.test]
|
|
110
|
+
installer = "uv"
|
|
111
|
+
path = ".venv/test"
|
|
112
|
+
pre-install-commands = ["uv pip install --group test -e ."]
|
|
113
|
+
|
|
114
|
+
[[tool.hatch.envs.test.matrix]]
|
|
115
|
+
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
116
|
+
|
|
117
|
+
################################################################################
|
|
118
|
+
## Versioningit Configuration
|
|
119
|
+
################################################################################
|
|
120
|
+
[tool.versioningit]
|
|
121
|
+
[tool.versioningit.vcs]
|
|
122
|
+
match = ["pact-python-cli/*"]
|
|
123
|
+
method = "git"
|
|
124
|
+
|
|
125
|
+
[tool.versioningit.tag2version]
|
|
126
|
+
rmprefix = "pact-python-cli/"
|
|
127
|
+
|
|
128
|
+
[tool.versioningit.write]
|
|
129
|
+
file = "src/pact_cli/__version__.py"
|
|
130
|
+
template = '''\
|
|
131
|
+
# This file is auto-generated by versioningit. Do not edit.
|
|
132
|
+
__version__ = "{version}"
|
|
133
|
+
__version_tuple__ = {version_tuple}
|
|
134
|
+
__commit_id__ = "{revision}"
|
|
135
|
+
'''
|
|
136
|
+
|
|
137
|
+
################################################################################
|
|
138
|
+
## PyTest Configuration
|
|
139
|
+
################################################################################
|
|
140
|
+
[tool.pytest]
|
|
141
|
+
addopts = [
|
|
142
|
+
"--import-mode=importlib",
|
|
143
|
+
# Coverage options
|
|
144
|
+
"--cov-config=pyproject.toml",
|
|
145
|
+
"--cov-report=xml",
|
|
146
|
+
"--cov=pact_cli",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
log_date_format = "%H:%M:%S"
|
|
150
|
+
log_format = "%(asctime)s.%(msecs)03d [%(levelname)-8s] %(name)s: %(message)s"
|
|
151
|
+
log_level = "NOTSET"
|
|
152
|
+
|
|
153
|
+
################################################################################
|
|
154
|
+
## Coverage
|
|
155
|
+
################################################################################
|
|
156
|
+
[tool.coverage]
|
|
157
|
+
|
|
158
|
+
[tool.coverage.paths]
|
|
159
|
+
pact-cli = ["/src/pact_cli"]
|
|
160
|
+
tests = ["/tests"]
|
|
161
|
+
|
|
162
|
+
[tool.coverage.report]
|
|
163
|
+
exclude_lines = [
|
|
164
|
+
"@(abc\\.)?abstractmethod", # Ignore abstract methods
|
|
165
|
+
"if TYPE_CHECKING:", # Ignore typing
|
|
166
|
+
"if __name__ == .__main__.:", # Ignore non-runnable code
|
|
167
|
+
"raise NotImplementedError", # Ignore defensive assertions
|
|
168
|
+
]
|
|
169
|
+
|
|
170
|
+
################################################################################
|
|
171
|
+
## Ruff Configuration
|
|
172
|
+
################################################################################
|
|
173
|
+
[tool.ruff]
|
|
174
|
+
extend = "../pyproject.toml"
|
|
175
|
+
|
|
176
|
+
exclude = []
|
|
177
|
+
|
|
178
|
+
################################################################################
|
|
179
|
+
## Mypy Configuration
|
|
180
|
+
################################################################################
|
|
181
|
+
[tool.mypy]
|
|
182
|
+
# Overwrite the exclusions from the root pyproject.toml.
|
|
183
|
+
exclude = ''
|
|
184
|
+
|
|
185
|
+
################################################################################
|
|
186
|
+
## CI Build Wheel
|
|
187
|
+
################################################################################
|
|
188
|
+
[tool.cibuildwheel]
|
|
189
|
+
# The repair tool unfortunately did not like the bundled Ruby distributable,
|
|
190
|
+
# with false-positives missing libraries despite being bundled.
|
|
191
|
+
repair-wheel-command = ""
|
|
192
|
+
|
|
193
|
+
[tool.cibuildwheel.windows]
|
|
194
|
+
archs = ["auto64"]
|
|
195
|
+
|
|
196
|
+
[[tool.cibuildwheel.overrides]]
|
|
197
|
+
environment.MACOSX_DEPLOYMENT_TARGET = "10.13"
|
|
198
|
+
select = "*-macosx_x86_64"
|
|
199
|
+
|
|
200
|
+
[[tool.cibuildwheel.overrides]]
|
|
201
|
+
environment.MACOSX_DEPLOYMENT_TARGET = "11.0"
|
|
202
|
+
select = "*-macosx_arm64"
|
pact_python_cli-0.0.0/PKG-INFO
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#:schema = "https://json.schemastore.org/pyproject.json"
|
|
2
|
-
[project]
|
|
3
|
-
description = "Pact CLI bundle for Python"
|
|
4
|
-
name = "pact-python-cli"
|
|
5
|
-
|
|
6
|
-
license = "MIT"
|
|
7
|
-
version = "0.0.0"
|
|
8
|
-
|
|
9
|
-
authors = [{ name = "Joshua Ellis", email = "josh@jpellis.me" }]
|
|
10
|
-
maintainers = [{ name = "Joshua Ellis", email = "josh@jpellis.me" }]
|
pact_python_cli-0.0.0/setup.cfg
DELETED