--- id: pact-python version: "3.4.0" license: MIT License Copyright (c) 2017 Pact Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) license_treatment: permissive maintenance: active --- # pact-python — Tool for creating and verifying consumer-driven contracts using the Pact framework. License: permissive · Maintenance: active · Downloads: 1.6M/mo ## What it is and what it does Pact Python is a consumer-driven contract testing framework that replaces expensive end-to-end integration tests with fast, reliable unit tests. Instead of spinning up full test environments and coordinating multiple services, you define contracts that specify what a client expects from a server and what a server will provide—then verify both sides independently against that contract. This catches breaking changes early and lets you test locally without complex fixtures or test environments. The package wraps the Pact framework (which supports 12+ languages) and provides a configurable mock server, powerful matching rules to prevent brittle assertions, and integration with Pact Broker or PactFlow for CI/CD workflows. It supports HTTP/REST and event-driven systems, runs on Python 3.10 and later across macOS, Windows, and Linux, and collects optional anonymous telemetry (disableable via PACT_DO_NOT_TRACK=1). Use it for: - Test microservice interactions locally without spinning up dependent services or complex test environments - Verify that API clients and servers remain compatible before deploying, catching breaking changes early - Document API contracts automatically and share them across teams via Pact Broker or PactFlow - Replace brittle end-to-end integration tests with fast, deterministic unit tests that run in CI/CD - Test event-driven systems by defining and verifying message contracts between producers and consumers ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Pact Python implements consumer-driven contract testing for APIs and microservices, letting you write fast unit tests that verify both client and server expectations against a shared contract instead of running brittle end-to-end integration tests. Yes. Pact Python is actively maintained, production-stable (Development Status 5), has no known vulnerabilities, low install friction, and solves a real problem—replacing expensive integration tests with reliable contract tests. The MIT license is permissive. Install it if you're testing APIs or microservices and want to shift testing left and reduce test environment complexity. ## Install pip install pact-python uv add pact-python poetry add pact-python ## Installing pact-python Before you install: Low friction installation with three runtime dependencies. Actively maintained with recent releases; last commit 2026-08-13 and 677 repository stars indicate ongoing development and community use. License in practice: MIT License permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions—only requiring preservation of copyright and license notices. Quickstart: pip install pact-python from pact import Consumer, Provider consumer = Consumer('MyConsumer') provider = Provider('MyProvider') # Define contract expectations and verify interactions Requires Python 3.10 or later; pact-python-ffi dependency may require a compatible FFI runtime on your system. Verify before relying: - Specific HTTP/REST and event-driven system capabilities and their scope of support - Details on the configurable mock server's feature set and configuration options - How the matching rules system works and what types of brittle test scenarios it prevents - Integration workflow details with Pact Broker / PactFlow for CI/CD - Whether telemetry can be fully disabled and what data collection occurs by default ## Package facts - License: MIT License Copyright (c) 2017 Pact Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags contract testing framework, API integration testing, consumer-driven contracts, microservice testing, mock server testing, pact testing, API contract verification, contract-testing, microservices, api-testing [View on SkillFed](https://skillfed.io/packages/pact-python) · [View on PyPI](https://pypi.org/project/pact-python/)