Skip to main content

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

Project description

Pact Python

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 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 here. Please be aware that only the [pact.v3 module][pact.v3] is thoroughly documented at this time.

Need Help

V3 Preview

Pact Python is currently undergoing a major rewrite which will be released with the 3.0.0 version. This rewrite will replace the existing Ruby backend with a Rust backend which will provide a significant performance improvement and will allow us to support more features in the future. You can find more information about this rewrite in this tracking issue on GitHub.

You can preview the new version by using the [pact.v3 module][pact.v3]. The new version is not yet feature complete, and may be subject to changes. Having said that, we would love to get your feedback on the new version:

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.

Do Not Track

In order to get better statistics as to who is using Pact, we have an anonymous tracking event that triggers when Pact installs for the first time. The only things we track are your type of OS, and the version information for the package being installed. No personally identifiable information is sent as part of this request. You can disable tracking 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


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-2.2.0.tar.gz (122.0 kB view hashes)

Uploaded Source

Built Distributions

pact_python-2.2.0-pp310-pypy310_pp73-win_amd64.whl (25.3 MB view hashes)

Uploaded PyPy Windows x86-64

pact_python-2.2.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (35.4 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pact_python-2.2.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.0 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

pact_python-2.2.0-pp310-pypy310_pp73-macosx_10_16_x86_64.whl (33.5 MB view hashes)

Uploaded PyPy macOS 10.16+ x86-64

pact_python-2.2.0-pp39-pypy39_pp73-win_amd64.whl (25.3 MB view hashes)

Uploaded PyPy Windows x86-64

pact_python-2.2.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (35.4 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pact_python-2.2.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.0 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

pact_python-2.2.0-pp39-pypy39_pp73-macosx_10_16_x86_64.whl (33.5 MB view hashes)

Uploaded PyPy macOS 10.16+ x86-64

pact_python-2.2.0-cp312-cp312-win_amd64.whl (25.3 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

pact_python-2.2.0-cp312-cp312-musllinux_1_1_x86_64.whl (16.9 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

pact_python-2.2.0-cp312-cp312-musllinux_1_1_aarch64.whl (16.6 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

pact_python-2.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (35.6 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pact_python-2.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

pact_python-2.2.0-cp312-cp312-macosx_10_16_x86_64.whl (33.5 MB view hashes)

Uploaded CPython 3.12 macOS 10.16+ x86-64

pact_python-2.2.0-cp312-cp312-macosx_10_16_arm64.whl (20.0 MB view hashes)

Uploaded CPython 3.12 macOS 10.16+ ARM64

pact_python-2.2.0-cp311-cp311-win_amd64.whl (25.3 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

pact_python-2.2.0-cp311-cp311-musllinux_1_1_x86_64.whl (16.9 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

pact_python-2.2.0-cp311-cp311-musllinux_1_1_aarch64.whl (16.5 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

pact_python-2.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (35.6 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pact_python-2.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

pact_python-2.2.0-cp311-cp311-macosx_10_16_x86_64.whl (33.5 MB view hashes)

Uploaded CPython 3.11 macOS 10.16+ x86-64

pact_python-2.2.0-cp311-cp311-macosx_10_16_arm64.whl (20.0 MB view hashes)

Uploaded CPython 3.11 macOS 10.16+ ARM64

pact_python-2.2.0-cp310-cp310-win_amd64.whl (25.3 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

pact_python-2.2.0-cp310-cp310-musllinux_1_1_x86_64.whl (16.9 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

pact_python-2.2.0-cp310-cp310-musllinux_1_1_aarch64.whl (16.5 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

pact_python-2.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (35.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pact_python-2.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

pact_python-2.2.0-cp310-cp310-macosx_10_16_x86_64.whl (33.5 MB view hashes)

Uploaded CPython 3.10 macOS 10.16+ x86-64

pact_python-2.2.0-cp310-cp310-macosx_10_16_arm64.whl (20.0 MB view hashes)

Uploaded CPython 3.10 macOS 10.16+ ARM64

pact_python-2.2.0-cp39-cp39-win_amd64.whl (25.3 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

pact_python-2.2.0-cp39-cp39-musllinux_1_1_x86_64.whl (16.9 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

pact_python-2.2.0-cp39-cp39-musllinux_1_1_aarch64.whl (16.5 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

pact_python-2.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (35.6 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pact_python-2.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

pact_python-2.2.0-cp39-cp39-macosx_10_16_x86_64.whl (33.5 MB view hashes)

Uploaded CPython 3.9 macOS 10.16+ x86-64

pact_python-2.2.0-cp39-cp39-macosx_10_16_arm64.whl (20.0 MB view hashes)

Uploaded CPython 3.9 macOS 10.16+ ARM64

pact_python-2.2.0-cp38-cp38-win_amd64.whl (25.3 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

pact_python-2.2.0-cp38-cp38-musllinux_1_1_x86_64.whl (16.9 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

pact_python-2.2.0-cp38-cp38-musllinux_1_1_aarch64.whl (16.5 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

pact_python-2.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (35.6 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pact_python-2.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

pact_python-2.2.0-cp38-cp38-macosx_10_16_x86_64.whl (33.5 MB view hashes)

Uploaded CPython 3.8 macOS 10.16+ x86-64

pact_python-2.2.0-cp38-cp38-macosx_10_16_arm64.whl (20.0 MB view hashes)

Uploaded CPython 3.8 macOS 10.16+ ARM64

Supported by

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