Skip to main content

Tool for creating and verifying consumer-driven contracts using the Pact framework.

Project description

Pact Python

Pact Python Mascot Fast, easy and reliable testing for your APIs and microservices.
Package Version Python Versions Downloads
CI/CD Test Status Build Status Build Status
Meta Hatch project linting - Ruff style - Ruff types - Mypy License
Community Issues Discussions GitHub Stars
Slack Stack Overflow Twitter
Pact is the de-facto API contract testing tool. Replace expensive and brittle end-to-end integration tests with fast, reliable and easy to debug unit tests.
  • ⚡ Lightning fast
  • 🎈 Effortless full-stack integration testing - from the front-end to the back-end
  • 🔌 Supports HTTP/REST and event-driven systems
  • 🛠️ Configurable mock server
  • 😌 Powerful matching rules prevents brittle tests
  • 🤝 Integrates with Pact Broker / PactFlow for powerful CI/CD workflows
  • 🔡 Supports 12+ languages

Why use Pact? Contract testing with Pact lets you:

  • ⚡ Test locally
  • 🚀 Deploy faster
  • ⬇️ Reduce the lead time for change
  • 💰 Reduce the cost of API integration testing
  • 💥 Prevent breaking changes
  • 🔎 Understand your system usage
  • 📃 Document your APIs for free
  • 🗄 Remove the need for complex data fixtures
  • 🤷‍♂️ Reduce the reliance on complex test environments

Watch our series on the problems with end-to-end integrated tests, and how contract testing can help.

Documentation

This readme provides a high-level overview of the Pact Python library. For detailed documentation, please refer to the full Pact Python documentation. For a more general overview of Pact and the rest of the ecosystem, please refer to the Pact documentation.

Documentation for the API is generated from the docstrings in the code which you can view at pact-foundation.github.io/pact-python/pact.

Need Help

Installation

The latest version of Pact Python can be installed from PyPi:

pip install pact-python
# 🚀 now write some tests!

Requirements

Pact Python tries to support all versions of Python that are still supported by the Python Software Foundation. Older version of Python may work, but are not officially supported.

In order to support the broadest range of use cases, Pact Python tries to impose the least restrictions on the versions of libraries that it uses.

Telemetry

In order to get better statistics as to who is using Pact, we collect some anonymous telemetry. The only things we record are your type of OS, and the version information for the package. No personally identifiable information is sent as part of this request. You can disable telemetry by setting the environment variable PACT_DO_NOT_TRACK=1:

Contributing

We welcome contributions to the Pact Python library in many forms. There are many ways to help, from writing code, to providing new examples, to writing documentation, to testing the library and providing feedback. For more information, see the contributing guide.

Table of contributors

Project details


Release history Release notifications | RSS feed

This version

3.4.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pact_python-3.4.0.tar.gz (82.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pact_python-3.4.0-py3-none-any.whl (97.7 kB view details)

Uploaded Python 3

File details

Details for the file pact_python-3.4.0.tar.gz.

File metadata

  • Download URL: pact_python-3.4.0.tar.gz
  • Upload date:
  • Size: 82.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pact_python-3.4.0.tar.gz
Algorithm Hash digest
SHA256 e4a500fa00e1fd586cecf473a74db1e604af5e1be97a312d88eced46c25395c0
MD5 a4ef8b78427bdc55a4794dfac435a9db
BLAKE2b-256 41d00f7b44586c232e86383a6224eb9f6bfb511d2c9630b692312506a879ac40

See more details on using hashes here.

Provenance

The following attestation bundles were made for pact_python-3.4.0.tar.gz:

Publisher: release-core.yml on pact-foundation/pact-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pact_python-3.4.0-py3-none-any.whl.

File metadata

  • Download URL: pact_python-3.4.0-py3-none-any.whl
  • Upload date:
  • Size: 97.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pact_python-3.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76e8fb55c403c2c87d45052b270535cd88af2cd4b60d7d17ae5714eb9d8a872a
MD5 c7d7b4e16efed9835916310c18dec935
BLAKE2b-256 3a63fb5c76d6c23504d5838f4da4219c81399b68211735939d1657ad568a016b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pact_python-3.4.0-py3-none-any.whl:

Publisher: release-core.yml on pact-foundation/pact-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page