Skip to content

Commit db041b6

Browse files
committed
fix!: replace v2 extra with compat-v2
The `v2` group of optional dependencies unfortunately results in an issue when Pact Python is installed using `pip`, as `pip` tries to parse the group name as if it were a version. To avoid this, the group has been renamed to `compat-v2` which should bypass the version parsing. While this is a bug in `pip`, pip comes pre-bundled in many situations and is rarely at the latest version; so it is impractical to wait for the upstream issue to be resolved. BREAKING CHANGE: Installing Pact Python with v2 compatibility requires `pip install 'pact-python[compat-v2]'`, and the old `pip install 'pact-python[v2]'` is no longer supported. Fixes: #1275 Ref: pypa/packaging#938 Signed-off-by: JP-Ellis <[email protected]>
1 parent 8b503a8 commit db041b6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

MIGRATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ This document outlines the key changes and migration steps for users transitioni
2020

2121
For teams with larger codebases that need time to fully migrate to the new v3 API, a backwards compatibility module is provided at `pact.v2`. This module contains the same API as Pact Python v2.x and serves as an interim measure to assist gradual migration.
2222

23-
To use the v2 compatibility module, you must install pact-python with the `v2` feature enabled:
23+
To use the v2 compatibility module, you must install pact-python with the `compat-v2` feature enabled:
2424

2525
```bash
26-
pip install pact-python[v2]
26+
pip install pact-python[compat-v2]
2727
```
2828

2929
All existing `pact.*` imports need to be updated to use `pact.v2.*` instead. Here are some common examples:

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dependencies = [
5858

5959
[project.optional-dependencies]
6060
# Dependencies required for v2 only
61-
v2 = [
61+
compat-v2 = [
6262
# Pact dependencies
6363
"pact-python-cli~=2.0",
6464
# External dependencies
@@ -239,7 +239,7 @@ requires = ["hatch-vcs", "hatchling"]
239239
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
240240

241241
[tool.hatch.envs.v2-test]
242-
features = ["v2"]
242+
features = ["compat-v2"]
243243
installer = "uv"
244244
path = ".venv/v2-test"
245245
pre-install-commands = ["uv pip install --group test-v2 -e ."]
@@ -252,7 +252,7 @@ requires = ["hatch-vcs", "hatchling"]
252252
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
253253

254254
[tool.hatch.envs.v2-example]
255-
features = ["v2"]
255+
features = ["compat-v2"]
256256
installer = "uv"
257257
path = ".venv/v2-example"
258258
pre-install-commands = ["uv pip install --group example-v2 -e ."]

0 commit comments

Comments
 (0)