NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #3944 most downloaded on PyPI
Tool for creating and verifying consumer-driven contracts using the Pact framework.
Last release 17 days ago
17 Sep 2026
Ships fairly regularly
a new release about every 3 months
Nearly every release is documented
notes for 56 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
81 releases · first in 2017
Replace deprecated codecov action
🚀 Features Add external reference dsl Contributors @rholshausen @JP-Ellis
One column per quarter.
🐛 Bug Fixes Avoid rare port clash ⚙️ Miscellaneous Tasks Simplify find_free_port Replace pre-commit with prek Contributors @JP-Ellis
A new pact.xml module provides builder functions for constructing XML request and response bodies with embedded Pact matchers. Use xml.element() to de
Add xml matching
A new pact.xml module provides builder functions for constructing XML request and response bodies with embedded Pact matchers. Use xml.element() to describe the XML structure and attach matchers where needed, then wrap the result with xml.body() before passing it to with_body(..., content_type="application/xml"):
from pact import match, xml
response = xml.body(
xml.element(
"user",
xml.element("id", match.int(123)),
xml.element("name", match.str("Alice")),
)
)
interaction.with_body(response, content_type="application/xml")Repeating elements are supported via .each(min=1, examples=2) on any XmlElement. Attributes (including namespace declarations) can be passed via the attrs keyword argument.
Allow iteration over all interactions
Use common PactInteraction type
Can toggle follow redirects
Allow plugin loading delay
Update changelog for pact-python/3.2.0
Full Changelog: pact-python/3.2.0...pact-python/3.2.1
Use correct matching rule serialisation
<!-- generated by git-cliff on 2025-12-02-->
<details> <summary>
</summary>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/pact-python/3.1.0...pact-python/3.2.0
[breaking] Replace v2 extra with compat-v2
Installing Pact Python with v2 compatibility requires
pip install 'pact-python[compat-v2]', and the oldpip install 'pact-python[v2]'is no longer supported.
<!-- generated by git-cliff on 2025-10-07-->
<details> <summary>
</summary>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/pact-python/3.0.1...pact-python/3.1.0
Update changelog for pact-python/3.0.0
<details> <summary>
</summary>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/pact-python/3.0.0...pact-python/3.0.1
This is a complete rework from version 2.x and will require manual changes. The below change log reflects only the changes since the 3.0.0a1 release o
This is a complete rework from version 2.x and will require manual changes. The below change log reflects only the changes since the 3.0.0a1 release only, and the work leading up to 3.0.0 has been spread across a number of releases.
Please refer to the migration guide for a complete guide on how to migrate to 3.x. The consumer and provider docs have also been update to use the new interface.
Pact instances default to version 4 of the Pact specification (previously used version 3). This should be mostly backwards compatible, but can be reverted by using
with_specification("V3").
The abstract
pact.match.Matcherclass has been renamed topact.match.AbstractMatcher.
The abstract
pact.generate.Generatorclass has been renamed topact.generate.AbstractGenerator.
Python 3.9 is no longer supported.
<!-- generated by git-cliff on 2025-10-06-->
<details> <summary>
</summary>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/pact-python/3.0.0a1...pact-python/3.0.0
_(cli)_ Build abi-agnostic wheels
pact.v3.ffiis removed, and to be replaced bypact_ffi. That is,pact.v3.ffi.$fnshould be replaced bypact_ffi.$fn.
This prepares for version 3. Pact Python v2 will be still accessible under
pact.v2and all imports should be appropriate renamed. Everyone is encouraged to migrate to Pact Python v3.
given
The signature of
Interaction.givenhas been updated. The following changes are required: - Changegiven("state", key="user_id", value=123)togiven("state", user_id=123). This can take an arbitrary number of keyword arguments. If the key is not a valid Python keyword argument, use the dictionary input below. - Changegiven("state", parameters={"user_id": 123})togiven("state", {"user_id": 123}).
As the metadata values are now deserialised, the type of the metadata values may change. For example, setting metadata
user_id=123will now pass{"user_id": 123}through to the function handler. Previously, this would have been{"user_id": "123"}.
If you relied on the previous default (undocumented) behaviour, prefer specifying the format explicitly now:
match.datetime(regex="%Y-%m-%dT%H:%M:%S.%f%z").
If a branch is set through either
set_publish_optionsorprovider_branch, the value will be saved and used as a default for both in subsequent calls.
pact_cli packagepact-python/* tags<!-- generated by git-cliff on 2025-08-12-->
<details> <summary>
</summary>
given by @JP-Ellis in https://github.com/pact-foundation/pact-python/pull/1150</details>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/pact-python-ffi/0.4.22.0...pact-python/3.0.0a1
_(v3)_ Add will_respond_with for sync
<!-- generated by git-cliff on 2025-07-17-->
<details> <summary>
</summary>
</details>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.3.2...v2.3.3
_(v3)_ [breaking] Allow more flexible functional arguments
The signature of functional arguments must form a subset of the
MessageProducerArgsandStateHandlerArgstyped dictionaries.
<!-- generated by git-cliff on 2025-05-07-->
<details><summary>
</summary>
</details>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.3.1...v2.3.2
v3: defer setting pact broker source
<details> <summary>
</summary>
</details>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.3.0...v2.3.1
message_handler signature has been changed and expanded.
pact.v3 only)message_handler signature has been changed and expanded.set_state has been renamed to state_handler. If using a URL still, the body keyword argument is now a required parameter.Verifier constructor, instead of the first argument of the set_info method.set_info verifier method is removed, with add_transport needing to be used.pact.v3.util has been renamed to pact.v3._util and is now private.__exit__ arguments no longer have leading underscores. This is typically handled by Python itself and therefore is unlikely to be a change for any user, unless the end user was calling the __exit__ method explicitly and using keyword arguments.For a more detailed explanation of the changes, see the following blog post:
<details> <summary>
</summary>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.2.2...v2.3.0
The provider name must be given as an argument of the
Verifierconstructor, instead of the first argument of theset_infomethod.
set_statehas been renamed tostate_handler. If using a URL still, thebodykeyword argument is now a required parameter.
message_handlersignature has been changed and expanded.
The PactServer
__exit__arguments no longer have leading underscores. This is typically handled by Python itself and therefore is unlikely to be a change for any user, unless the end user was calling the__exit__method explicitly and using keyword arguments.
pact.v3.utilhas been renamed topact.v3._utiland is now private.
The srv.mismatches is changed from a list[dict[str, Any]] to a list[Mismatch].
srv.mismatches is changed from a list[dict[str, Any]] to a list[Mismatch].| over Optional and Union<details> <summary>
</summary>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.2.1...v2.2.2
The
srv.mismatchesis changed from alist[dict[str, Any]]to alist[Mismatch].
Python 3.8 support dropped
| over Optional and Unionv3: remove deprecated messages iterator
with_binary_body_add_body a method of Body<details><summary>
</summary>
</details>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.2.0...v2.2.1
with_binary_body_add_body a method of Bodytruncatev3: strip embedded user/password from urls
<details> <summary>
</summary>
</details>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.1.3...v2.2.0
chore: update changelog by @JP-Ellis in https://github.com/pact-foundation/pact-python/pull/585
<details> <summary>
</summary>
CONTRIBUTING.md by @JP-Ellis in https://github.com/pact-foundation/pact-python/pull/594</summary>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.1.2...v2.1.3
CONTRIBUTING.mdtest: ignore internal deprecation warnings
pact.constants.broker_client_exe() use pact.constants.BROKER_CLIENT_PATH instead.PACT_USE_SYSTEM_BINS to True or Yes (case insensitive).v3.ffi modulewith_binary_file__next__ implementation__repr__ implementationlib dir<details> <summary>
</summary>
</details>
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.1.0...v2.1.2
with_binary_fileThe public functions within the constants module have been removed. If you previously used them, please make use of the constants. For example, instead of
pact.constants.broker_client_exe()usepact.constants.BROKER_CLIENT_PATHinstead.
Nothing published for this version
chore: update MANIFEST file to note 2.0.2 standalone by @YOU54F in https://github.com/pact-foundation/pact-python/pull/359
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v2.0.0...v2.0.1
doc: actualise guide on how to make contributions by @sergeyklay in https://github.com/pact-foundation/pact-python/pull/328
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v1.7.0...v2.0.0
Minor to incorporate a few misc changes dating 6 months
Minor to incorporate a few misc changes dating 6 months
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v1.6.0...v1.7.0
Support publish pact with branch
Update PACT_STANDALONE_VERSION to 1.88.83
Message_pact -> with_metadata() updated to accept term
### 🚀 Features - No include pending (#284) ### ⚙️ Miscellaneous Tasks - Releasing version 1.5.0 ### � Other - Python36-support-removed (#283) ### Cont
_(matcher)_ Allow bytes type in from_term function
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v1.4.4...v1.4.5
Full Changelog: https://github.com/pact-foundation/pact-python/compare/v1.4.4...v1.4.5
_(ruby)_ Update ruby standalone to support disabling SSL verification via an environment variable
Added support for message provider using pact broker
Bundle Ruby standalones into dist artifact.
Make uvicorn versions over 0.14
Added support for message provider
Change default from empty string to empty list
Fix datetime serialization issues in Format
_(broker)_ Token added to verify steps
Docker/py36.Dockerfile to reduce vulnerabilities
_(publish)_ Fixing the fix. Pact Python api uses only publish_version and ensures it follows that
### 🐛 Bug Fixes - Verifier should now publish ### ⚙️ Miscellaneous Tasks - Releasing version 1.3.4 ### Contributors - @elliottmurray
### 🐛 Bug Fixes - Pass pact_dir to publish() ### ⚙️ Miscellaneous Tasks - Releasing version 1.3.3 ### Contributors - @elliottmurray - @
Ensure path is passed to broker and allow running from root rather than test file
Introduced and renamed specification version
Create basic tests for single pact message
### 🐛 Bug Fixes - Not creating wheel ### ⚙️ Miscellaneous Tasks - Releasing version 1.2.11 ### Contributors - @elliottmurray
Fix small typo in with_request doc string
with_request doc string_(verifier)_ Allow setting consumer_version_selectors on Verifier
_(verifier)_ Support include-wip-pacts-since in CLI
_(verifier)_ Headers not propagated properly
_(verifier)_ Allow to use unauthenticated brokers
_(verifier)_ Add enable_pending argument handling in verify wrapper
_(cli)_ Add consumer-version-selector option
Release script updates version automatically now
Added env vars for broker verify
### 🐛 Bug Fixes - Custom headers had a typo ### 📚 Documentation - Example code verifier - Merged 2 examples ### ⚙️ Miscellaneous Tasks - Releasing ver
Create beta verifier class and api
Removed some files and moved a few things around
Nothing published for this version
Nothing published for this version
Added python 3.8 support, fixed bug on multiple custom headers and consumer name on publish. Revisited some samples and provided first pass at some ba
Added python 3.8 support, fixed bug on multiple custom headers and consumer name on publish. Revisited some samples and provided first pass at some basic docker images. Some repo clean up.
Your coding agent can read these notes before it upgrades. Set up the MCP server →