forked from pact-foundation/pact-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
260 lines (224 loc) · 7.98 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
[project]
name = "pact-python"
description = "Tool for creating and verifying consumer-driven contracts using the Pact framework."
dynamic = ["version"]
authors = [{ name = "Matthew Balvanz", email = "matthew.balvanz@workiva.com" }]
maintainers = [{ name = "Joshua Ellis", email = "josh@jpellis.me" }]
readme = "README.md"
license = { file = "LICENSE" }
keywords = ["pact", "contract-testing", "testing"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Testing",
]
requires-python = ">=3.8, <3.12"
# Dependencies of Pact Python should be specified using the broadest range
# compatible version unless:
#
# - A specific feature is required in a new minor release
# - A minor version address vulnerability which directly impacts Pact Python
dependencies = [
"cffi ~= 1.0",
"click ~= 8.0",
"fastapi ~= 0.0",
"psutil ~= 5.0",
"requests ~= 2.0",
"six ~= 1.0",
"typing-extensions ~= 4.0 ; python_version < '3.10'",
"uvicorn ~= 0.0",
"yarl ~= 1.0",
]
[project.urls]
"Homepage" = "https://pact.io"
"Repository" = "https://github.com/pact-foundation-pact-python"
"Documentation" = "https://docs.pact.io"
"Bug Tracker" = "https://github.com/pact-foundation/pact-python/issues"
"Changelog" = "https://github.com/pact-foundation/pact-python/blob/master/CHANGELOG.md"
[project.scripts]
pact-verifier = "pact.cli.verify:main"
[project.optional-dependencies]
# Linting and formatting tools use a more narrow specification to ensure
# developper consistency. All other dependencies are as above.
types = [
"mypy ==1.6.1",
"types-cffi ~= 1.0",
"types-requests ~= 2.0",
]
test = [
"aiohttp[speedups] ~= 3.0",
"coverage[toml] ~= 7.0",
"flask[async] ~= 3.0",
"httpx ~= 0.0",
"mock ~= 5.0",
"pytest ~= 7.0",
"pytest-asyncio ~= 0.0",
"pytest-cov ~= 4.0",
"testcontainers ~= 3.0",
]
dev = [
"pact-python[types]",
"pact-python[test]",
"black == 23.10.1",
"ruff ==0.1.4",
]
################################################################################
## Hatch Build Configuration
################################################################################
[build-system]
requires = ["hatchling", "packaging", "requests", "cffi"]
build-backend = "hatchling.build"
[tool.hatch.version]
path = "pact/__version__.py"
[tool.hatch.build]
include = ["**/py.typed", "**/*.md", "LICENSE", "pact/**/*.py", "pact/**/*.pyi"]
[tool.hatch.build.targets.wheel]
# Ignore the data files in the wheel as their contents are already included
# in the package.
artifacts = ["pact/bin/*", "pact/lib/*", "pact/v3/_ffi.*"]
[tool.hatch.build.targets.wheel.hooks.custom]
################################################################################
## Hatch Environment Configuration
################################################################################
# Install dev dependencies in the default environment to simplify the developer
# workflow.
[tool.hatch.envs.default]
features = ["dev"]
extra-dependencies = ["hatchling", "packaging", "requests", "cffi"]
[tool.hatch.envs.default.scripts]
lint = ["black --check --diff {args:.}", "ruff {args:.}", "mypy {args:.}"]
test = "pytest {args:tests/}"
example = "pytest {args:examples/}"
all = ["lint", "test", "example"]
# Test environment for running unit tests. This automatically tests against all
# supported Python versions.
[tool.hatch.envs.test]
features = ["test"]
[[tool.hatch.envs.test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11"]
[tool.hatch.envs.test.scripts]
test = "pytest {args:tests/}"
example = "pytest {args:examples/}"
all = ["test", "example"]
################################################################################
## PyTest Configuration
################################################################################
[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
"--cov-config=pyproject.toml",
"--cov=pact",
"--cov-report=xml",
]
filterwarnings = [
"ignore::DeprecationWarning:pact",
"ignore::DeprecationWarning:tests",
"ignore::PendingDeprecationWarning:pact",
"ignore::PendingDeprecationWarning:tests",
]
################################################################################
## Coverage
################################################################################
[tool.coverage.report]
exclude_lines = [
"if __name__ == .__main__.:", # Ignore non-runnable code
"if TYPE_CHECKING:", # Ignore typing
"raise NotImplementedError", # Ignore defensive assertions
"@(abc\\.)?abstractmethod", # Ignore abstract methods
]
################################################################################
## Ruff Configuration
################################################################################
[tool.ruff]
target-version = "py38"
select = ["ALL"]
ignore = [
"D200", # Require single line docstrings to be on one line.
"D203", # Require blank line before class docstring
"D212", # Multi-line docstring summary must start at the first line
"ANN101", # `self` must be typed
"ANN102", # `cls` must be typed
"FIX002", # Forbid TODO in comments
]
# TODO: Remove the explicity extend-exclude once astral-sh/ruff#6262 is fixed.
# https://github.com/pact-foundation/pact-python/issues/458
extend-exclude = [
# "pact/*.py",
# "pact/cli/*.py",
# "tests/*.py",
# "tests/cli/*.py",
"pact/__init__.py",
"pact/__version__.py",
"pact/broker.py",
"pact/cli/*.py",
"pact/constants.py",
"pact/consumer.py",
"pact/http_proxy.py",
"pact/matchers.py",
"pact/message_consumer.py",
"pact/message_pact.py",
"pact/message_provider.py",
"pact/pact.py",
"pact/provider.py",
"pact/verifier.py",
"pact/verify_wrapper.py",
"tests/__init__.py",
"tests/cli/*.py",
"tests/conftest.py",
"tests/test_broker.py",
"tests/test_constants.py",
"tests/test_consumer.py",
"tests/test_http_proxy.py",
"tests/test_matchers.py",
"tests/test_message_consumer.py",
"tests/test_message_pact.py",
"tests/test_message_provider.py",
"tests/test_pact.py",
"tests/test_verifier.py",
"tests/test_verify_wrapper.py",
]
[tool.ruff.pyupgrade]
keep-runtime-typing = true
[tool.ruff.pydocstyle]
convention = "google"
################################################################################
## Black Configuration
################################################################################
[tool.black]
target-version = ["py38"]
extend-exclude = '^/(pact|tests)/(?!v3).+\.py$'
################################################################################
## Mypy Configuration
################################################################################
[tool.mypy]
exclude = '^(pact|tests)/(?!v3).+\.py$'
################################################################################
## CI Build Wheel
################################################################################
[tool.cibuildwheel]
test-command = """
python -c \
"from pact import EachLike; \
assert \
EachLike(1).generate() \
== {'json_class': 'Pact::ArrayLike', 'contents': 1, 'min': 1}; \
import pact.v3.ffi; \
assert isinstance(pact.v3.ffi.version(), str);\""""
[tool.cibuildwheel.macos]
# The repair tool unfortunately did not like the bundled Ruby distributable.
# TODO: Check whether delocate-wheel can be configured.
repair-wheel-command = ""
[tool.cibuildwheel.windows]
# Skipping pypy, see giampaolo/psutil#2325
skip = "pp*"